001: /*
002: * Created on Aug 11, 2005
003: *
004: * description:
005: * This class loads all openjump plugins.
006: * The method loadOpenJumpPlugIns() is called from
007: * com.vividsolutions.jump.workbench.JUMPConfiguaration.
008: *
009: *
010: */
011: package org.openjump;
012:
013: import javax.swing.JPopupMenu;
014:
015: import org.openjump.core.ccordsys.srid.EnsureAllLayersHaveSRIDStylePlugIn;
016: import org.openjump.core.ui.plugin.customize.BeanToolsPlugIn;
017: import org.openjump.core.ui.plugin.edit.ReplicateSelectedItemsPlugIn;
018: import org.openjump.core.ui.plugin.edit.SelectAllLayerItemsPlugIn;
019: import org.openjump.core.ui.plugin.edit.SelectByTypePlugIn;
020: import org.openjump.core.ui.plugin.edit.SelectItemsByCircleFromSelectedLayersPlugIn;
021: import org.openjump.core.ui.plugin.edit.SelectItemsByFenceFromSelectedLayersPlugIn;
022: import org.openjump.core.ui.plugin.edittoolbox.ConstrainedMoveVertexPlugIn;
023: import org.openjump.core.ui.plugin.edittoolbox.DrawCircleWithGivenRadiusPlugIn;
024: import org.openjump.core.ui.plugin.edittoolbox.DrawConstrainedArcPlugIn;
025: import org.openjump.core.ui.plugin.edittoolbox.DrawConstrainedCirclePlugIn;
026: import org.openjump.core.ui.plugin.edittoolbox.DrawConstrainedLineStringPlugIn;
027: import org.openjump.core.ui.plugin.edittoolbox.DrawConstrainedPolygonPlugIn;
028: import org.openjump.core.ui.plugin.edittoolbox.RotateSelectedItemPlugIn;
029: import org.openjump.core.ui.plugin.edittoolbox.SelectOneItemPlugIn;
030: import org.openjump.core.ui.plugin.file.SaveImageAsSVGPlugIn;
031: import org.openjump.core.ui.plugin.layer.AddSIDLayerPlugIn;
032: import org.openjump.core.ui.plugin.layer.ChangeLayerableNamePlugIn;
033: import org.openjump.core.ui.plugin.layer.ChangeSRIDPlugIn;
034: import org.openjump.core.ui.plugin.layer.ToggleVisiblityPlugIn;
035: import org.openjump.core.ui.plugin.mousemenu.EditSelectedSidePlugIn;
036: import org.openjump.core.ui.plugin.mousemenu.MoveAlongAnglePlugIn;
037: import org.openjump.core.ui.plugin.mousemenu.RotatePlugIn;
038: import org.openjump.core.ui.plugin.mousemenu.SaveDatasetsPlugIn;
039: import org.openjump.core.ui.plugin.queries.SimpleQueryPlugIn;
040: import org.openjump.core.ui.plugin.tools.BlendLineStringsPlugIn;
041: import org.openjump.core.ui.plugin.tools.ConvexHullPlugIn;
042: import org.openjump.core.ui.plugin.tools.CreateThiessenPolygonsPlugIn;
043: import org.openjump.core.ui.plugin.tools.CutPolygonPlugIn;
044: import org.openjump.core.ui.plugin.tools.DeleteEmptyGeometriesPlugIn;
045: import org.openjump.core.ui.plugin.tools.JoinAttributesSpatiallyPlugIn;
046: import org.openjump.core.ui.plugin.tools.JoinWithArcPlugIn;
047: import org.openjump.core.ui.plugin.tools.LineSimplifyJTS15AlgorithmPlugIn;
048: import org.openjump.core.ui.plugin.tools.MeasureM_FPlugIn;
049: import org.openjump.core.ui.plugin.tools.MergeTwoSelectedPolygonsPlugIn;
050: import org.openjump.core.ui.plugin.tools.ReducePointsISAPlugIn;
051: import org.openjump.core.ui.plugin.view.InstallKeyPanPlugIn;
052: import org.openjump.core.ui.plugin.view.MapToolTipPlugIn;
053: import org.openjump.core.ui.plugin.view.ShowFullPathPlugIn;
054: import org.openjump.core.ui.plugin.view.ShowScalePlugIn;
055: import org.openjump.core.ui.plugin.view.ZoomToScalePlugIn;
056: import org.openjump.core.ui.plugin.wms.ZoomToWMSPlugIn;
057: import org.openjump.core.ui.style.decoration.ArrowLineStringMiddlepointStyle;
058: import org.openjump.sigle.plugin.geoprocessing.layers.SpatialJoinPlugIn;
059: import org.openjump.sigle.plugin.geoprocessing.oneLayer.topology.PlanarGraphPlugIn;
060: import org.openjump.sigle.plugin.joinTable.JoinTablePlugIn;
061: import org.openjump.sigle.plugin.replace.ReplaceValuePlugIn;
062:
063: import com.vividsolutions.jump.workbench.WorkbenchContext;
064: import com.vividsolutions.jump.workbench.plugin.PlugInContext;
065: import com.vividsolutions.jump.workbench.ui.EditTransaction;
066: import com.vividsolutions.jump.workbench.ui.LayerViewPanel;
067: import com.vividsolutions.jump.workbench.ui.plugin.BeanShellPlugIn;
068:
069: import de.fho.jump.pirol.plugins.EditAttributeByFormula.EditAttributeByFormulaPlugIn;
070: import de.latlon.deejump.plugin.SaveLegendPlugIn;
071: import de.latlon.deejump.plugin.manager.ExtensionManagerPlugIn;
072: import de.latlon.deejump.plugin.style.LayerStyle2SLDPlugIn;
073:
074: /**
075: * @description:
076: * This class loads all openjump plugins.
077: * The method loadOpenJumpPlugIns() is called from
078: * com.vividsolutions.jump.workbench.JUMPConfiguaration.
079:
080: * @author sstein
081: *
082: */
083: public class OpenJumpConfiguration {
084:
085: public static void loadOpenJumpPlugIns(
086: final WorkbenchContext workbenchContext) throws Exception {
087:
088: /*-----------------------------------------------
089: * add here first the field which holds the plugin
090: * and afterwards initialize it for the menu
091: *-----------------------------------------------*/
092:
093: /***********************
094: * menu FILE
095: **********************/
096: SaveImageAsSVGPlugIn imageSvgPlugin = new SaveImageAsSVGPlugIn();
097: imageSvgPlugin.initialize(new PlugInContext(workbenchContext,
098: null, null, null, null));
099:
100: /***********************
101: * menu EDIT
102: **********************/
103: SelectItemsByFenceFromSelectedLayersPlugIn selectItemsFromLayersPlugIn = new SelectItemsByFenceFromSelectedLayersPlugIn();
104: selectItemsFromLayersPlugIn.initialize(new PlugInContext(
105: workbenchContext, null, null, null, null));
106:
107: SelectItemsByCircleFromSelectedLayersPlugIn selectItemsFromCirclePlugIn = new SelectItemsByCircleFromSelectedLayersPlugIn();
108: selectItemsFromCirclePlugIn.initialize(new PlugInContext(
109: workbenchContext, null, null, null, null));
110:
111: SelectAllLayerItemsPlugIn selectAllLayerItemsPlugIn = new SelectAllLayerItemsPlugIn();
112: selectAllLayerItemsPlugIn.initialize(new PlugInContext(
113: workbenchContext, null, null, null, null));
114:
115: ReplicateSelectedItemsPlugIn replicatePlugIn = new ReplicateSelectedItemsPlugIn();
116: replicatePlugIn.initialize(new PlugInContext(workbenchContext,
117: null, null, null, null));
118:
119: SelectByTypePlugIn mySelectByGeomTypePlugIn = new SelectByTypePlugIn();
120: mySelectByGeomTypePlugIn.initialize(new PlugInContext(
121: workbenchContext, null, null, null, null));
122:
123: /***********************
124: * menu VIEW
125: **********************/
126:
127: ZoomToWMSPlugIn myZoomToWMSPlugIn = new ZoomToWMSPlugIn();
128: myZoomToWMSPlugIn.initialize(new PlugInContext(
129: workbenchContext, null, null, null, null));
130:
131: ZoomToScalePlugIn myZoomToScalePlugIn = new ZoomToScalePlugIn();
132: myZoomToScalePlugIn.initialize(new PlugInContext(
133: workbenchContext, null, null, null, null));
134:
135: ShowScalePlugIn myShowScalePlugIn = new ShowScalePlugIn();
136: myShowScalePlugIn.initialize(new PlugInContext(
137: workbenchContext, null, null, null, null));
138:
139: MapToolTipPlugIn myMapTipPlugIn = new MapToolTipPlugIn();
140: myMapTipPlugIn.initialize(new PlugInContext(workbenchContext,
141: null, null, null, null));
142:
143: //-- deeJUMP function by LAT/LON [01.08.2006 sstein]
144: LayerStyle2SLDPlugIn mySytle2SLDplugIn = new LayerStyle2SLDPlugIn();
145: mySytle2SLDplugIn.initialize(new PlugInContext(
146: workbenchContext, null, null, null, null));
147: //-- to install in Toolbar
148: //mySytle2SLDplugIn.install(new PlugInContext(workbenchContext, null, null, null, null));
149:
150: //--this caused problems with the postgis plugin [sstein]
151: // TODO: the problem has been solved (using try/catch) but still class has to be
152: // changed using LayerListener LayerEventType.ADDED event instead of
153: // layerSelectionChanged() from LayerNamePanelListener
154: ShowFullPathPlugIn myFullPathPlugin = new ShowFullPathPlugIn();
155: myFullPathPlugin.initialize(new PlugInContext(workbenchContext,
156: null, null, null, null));
157:
158: /***********************
159: * menu LAYER
160: **********************/
161:
162: ToggleVisiblityPlugIn myToggleVisPlugIn = new ToggleVisiblityPlugIn();
163: myToggleVisPlugIn.initialize(new PlugInContext(
164: workbenchContext, null, null, null, null));
165:
166: AddSIDLayerPlugIn myMrSIDPlugIn = new AddSIDLayerPlugIn();
167: myMrSIDPlugIn.initialize(new PlugInContext(workbenchContext,
168: null, null, null, null));
169:
170: ChangeSRIDPlugIn myChangeSRIDPlugIn = new ChangeSRIDPlugIn();
171: myChangeSRIDPlugIn.initialize(new PlugInContext(
172: workbenchContext, null, null, null, null));
173:
174: /***********************
175: * menu TOOLS
176: **********************/
177:
178: /**** ANALYSIS ****/
179: JoinAttributesSpatiallyPlugIn mySpatialJoin = new JoinAttributesSpatiallyPlugIn();
180: mySpatialJoin.initialize(new PlugInContext(workbenchContext,
181: null, null, null, null));
182:
183: //-- SIGLE PlugIn
184: PlanarGraphPlugIn coveragePlugIn = new PlanarGraphPlugIn();
185: coveragePlugIn.initialize(new PlugInContext(workbenchContext,
186: null, null, null, null));
187:
188: /**** GENERATE ****/
189: ConvexHullPlugIn myConvHullPlugIn = new ConvexHullPlugIn();
190: myConvHullPlugIn.initialize(new PlugInContext(workbenchContext,
191: null, null, null, null));
192:
193: CreateThiessenPolygonsPlugIn myThiessenPlugin = new CreateThiessenPolygonsPlugIn();
194: myThiessenPlugin.initialize(new PlugInContext(workbenchContext,
195: null, null, null, null));
196:
197: /**** QUERY ****/
198: SimpleQueryPlugIn mySimpleQueryPlugIn = new SimpleQueryPlugIn();
199: mySimpleQueryPlugIn.initialize(new PlugInContext(
200: workbenchContext, null, null, null, null));
201:
202: /**** QA ****/
203: DeleteEmptyGeometriesPlugIn myDelGeomPlugin = new DeleteEmptyGeometriesPlugIn();
204: myDelGeomPlugin.initialize(new PlugInContext(workbenchContext,
205: null, null, null, null));
206:
207: /**** EDIT_GEOMETRY ****/
208: JoinWithArcPlugIn myJoinWithArcPlugIn = new JoinWithArcPlugIn();
209: myJoinWithArcPlugIn.initialize(new PlugInContext(
210: workbenchContext, null, null, null, null));
211:
212: BlendLineStringsPlugIn myLSBlender = new BlendLineStringsPlugIn();
213: myLSBlender.initialize(new PlugInContext(workbenchContext,
214: null, null, null, null));
215:
216: MergeTwoSelectedPolygonsPlugIn twopolymerger = new MergeTwoSelectedPolygonsPlugIn();
217: twopolymerger.initialize(new PlugInContext(workbenchContext,
218: null, null, null, null));
219:
220: CutPolygonPlugIn cutpoly = new CutPolygonPlugIn();
221: cutpoly.initialize(new PlugInContext(workbenchContext, null,
222: null, null, null));
223:
224: /**** EDIT_ATTIBUTES *****/
225: ReplaceValuePlugIn myRepVal = new ReplaceValuePlugIn();
226: myRepVal.initialize(new PlugInContext(workbenchContext, null,
227: null, null, null));
228:
229: EditAttributeByFormulaPlugIn formulaEdit = new EditAttributeByFormulaPlugIn();
230: formulaEdit.initialize(new PlugInContext(workbenchContext,
231: null, null, null, null));
232:
233: SpatialJoinPlugIn spatialJoinPlugIn = new SpatialJoinPlugIn();
234: spatialJoinPlugIn.initialize(new PlugInContext(
235: workbenchContext, null, null, null, null));
236:
237: /**** GENERALIZATION ****/
238: ReducePointsISAPlugIn mySimplifyISA = new ReducePointsISAPlugIn();
239: mySimplifyISA.initialize(new PlugInContext(workbenchContext,
240: null, null, null, null));
241:
242: LineSimplifyJTS15AlgorithmPlugIn jtsSimplifier = new LineSimplifyJTS15AlgorithmPlugIn();
243: jtsSimplifier.initialize(new PlugInContext(workbenchContext,
244: null, null, null, null));
245:
246: /**** tools main ****/
247:
248: //-- [sstein] do this to avoid that the programming menu is created after
249: // MeasureM_FPlugIn is added to the tools menu
250: // [Michael Michaud 2007-03-23] : put programming plugins in MenuNames.CUSTOMIZE menu
251: /*
252: PlugInContext pc = new PlugInContext(workbenchContext, null, null, null, null);
253: FeatureInstaller fi = pc.getFeatureInstaller();
254: JMenu menuTools = fi.menuBarMenu(MenuNames.TOOLS);
255: fi.createMenusIfNecessary(menuTools, new String[]{MenuNames.TOOLS_PROGRAMMING});
256: */
257:
258: //-- deeJUMP function by LAT/LON [05.08.2006 sstein]
259: // [Michael Michaud 2007-03-23] move the plugin to the CUSTOMIZE menu (see here after)
260: /*
261: ExtensionManagerPlugIn extensionManagerPlugIn = new ExtensionManagerPlugIn();
262: extensionManagerPlugIn.install(new PlugInContext(workbenchContext, null, null, null, null));
263: */
264:
265: MeasureM_FPlugIn myFeetPlugIn = new MeasureM_FPlugIn();
266: myFeetPlugIn.initialize(new PlugInContext(workbenchContext,
267: null, null, null, null));
268:
269: /***********************
270: * menu vector geoprocessing
271: * previously used by Projet-sigle.org
272: ***********************/
273:
274: //-- Two layers
275: //-- One Layer
276: //-- Topology
277: /***********************
278: * menu CUSTOMIZE [added byte Michael Michaud on 2007-03-04]
279: **********************/
280: //-- deeJUMP function by LAT/LON [05.08.2006 sstein]
281: ExtensionManagerPlugIn extensionManagerPlugIn = new ExtensionManagerPlugIn();
282: extensionManagerPlugIn.install(new PlugInContext(
283: workbenchContext, null, null, null, null));
284:
285: //-- [michael michaud] move from JUMPConfiguration
286: BeanShellPlugIn beanShellPlugIn = new BeanShellPlugIn();
287: beanShellPlugIn.initialize(new PlugInContext(workbenchContext,
288: null, null, null, null));
289:
290: //-- [michael michaud] add Larry's BeanToolsPlugIn
291: BeanToolsPlugIn beanTools = new BeanToolsPlugIn();
292: beanTools.initialize(new PlugInContext(workbenchContext, null,
293: null, null, null));
294:
295: /***********************
296: * menu WINDOW
297: **********************/
298:
299: /***********************
300: * menu HELP
301: **********************/
302:
303: /***********************
304: * Right click menus
305: **********************/
306: JPopupMenu popupMenu = LayerViewPanel.popupMenu();
307: popupMenu.addSeparator();
308:
309: MoveAlongAnglePlugIn myMoveAlongAnglePlugin = new MoveAlongAnglePlugIn();
310: myMoveAlongAnglePlugin.initialize(new PlugInContext(
311: workbenchContext, null, null, null, null));
312:
313: RotatePlugIn myRotatePlugin = new RotatePlugIn();
314: myRotatePlugin.initialize(new PlugInContext(workbenchContext,
315: null, null, null, null));
316:
317: EditSelectedSidePlugIn myEditSidePlugin = new EditSelectedSidePlugIn();
318: myEditSidePlugin.initialize(new PlugInContext(workbenchContext,
319: null, null, null, null));
320:
321: SaveDatasetsPlugIn mySaveDataSetPlugIn = new SaveDatasetsPlugIn();
322: mySaveDataSetPlugIn.initialize(new PlugInContext(
323: workbenchContext, null, null, null, null));
324:
325: //-- deeJUMP plugin
326: SaveLegendPlugIn saveLegend = new SaveLegendPlugIn();
327: saveLegend.initialize(new PlugInContext(workbenchContext, null,
328: null, null, null));
329:
330: //-- SIGLE plugin
331: JoinTablePlugIn joinTablePlugIn = new JoinTablePlugIn();
332: joinTablePlugIn.initialize(new PlugInContext(workbenchContext,
333: null, null, null, null));
334:
335: ChangeLayerableNamePlugIn changeLayerableNamePlugIn = new ChangeLayerableNamePlugIn();
336: changeLayerableNamePlugIn.initialize(new PlugInContext(
337: workbenchContext, null, null, null, null));
338:
339: /***********************
340: * EDITing toolbox
341: **********************/
342:
343: DrawConstrainedPolygonPlugIn myConstrainedPolygonPlugIn = new DrawConstrainedPolygonPlugIn();
344: myConstrainedPolygonPlugIn.initialize(new PlugInContext(
345: workbenchContext, null, null, null, null));
346:
347: DrawConstrainedLineStringPlugIn myConstrainedLSPlugIn = new DrawConstrainedLineStringPlugIn();
348: myConstrainedLSPlugIn.initialize(new PlugInContext(
349: workbenchContext, null, null, null, null));
350:
351: DrawConstrainedCirclePlugIn myConstrainedCPlugIn = new DrawConstrainedCirclePlugIn();
352: myConstrainedCPlugIn.initialize(new PlugInContext(
353: workbenchContext, null, null, null, null));
354:
355: DrawConstrainedArcPlugIn myConstrainedArcPlugIn = new DrawConstrainedArcPlugIn();
356: myConstrainedArcPlugIn.initialize(new PlugInContext(
357: workbenchContext, null, null, null, null));
358:
359: ConstrainedMoveVertexPlugIn myCMVPlugIn = new ConstrainedMoveVertexPlugIn();
360: myCMVPlugIn.initialize(new PlugInContext(workbenchContext,
361: null, null, null, null));
362:
363: RotateSelectedItemPlugIn myRotateSIPlugIn = new RotateSelectedItemPlugIn();
364: myRotateSIPlugIn.initialize(new PlugInContext(workbenchContext,
365: null, null, null, null));
366:
367: SelectOneItemPlugIn mySelectOnePlugin = new SelectOneItemPlugIn();
368: mySelectOnePlugin.initialize(new PlugInContext(
369: workbenchContext, null, null, null, null));
370:
371: DrawCircleWithGivenRadiusPlugIn drawCirclePlugin = new DrawCircleWithGivenRadiusPlugIn();
372: drawCirclePlugin.initialize(new PlugInContext(workbenchContext,
373: null, null, null, null));
374:
375: //-- now initialized in #EditingPlugIn.java to fill toolbox
376: /*
377: ScaleSelectedItemsPlugIn myScaleItemsPlugin = new ScaleSelectedItemsPlugIn();
378: myScaleItemsPlugin.initialize(new PlugInContext(workbenchContext, null, null, null, null));
379: */
380:
381: /***********************
382: * others
383: **********************/
384:
385: // takes care of keyboard navigation
386: new InstallKeyPanPlugIn().initialize(new PlugInContext(
387: workbenchContext, null, null, null, null));
388:
389: //-- enables to store the SRID = EPSG code as style for every Layer
390: // since it is stored as style it should be saved in the project file
391: EnsureAllLayersHaveSRIDStylePlugIn ensureLayerSRIDPlugin = new EnsureAllLayersHaveSRIDStylePlugIn();
392: ensureLayerSRIDPlugin.initialize(new PlugInContext(
393: workbenchContext, null, null, null, null));
394:
395: /***********************
396: * Decoration
397: ***********************/
398:
399: workbenchContext
400: .getWorkbench()
401: .getFrame()
402: .addChoosableStyleClass(
403: ArrowLineStringMiddlepointStyle.NarrowSolidMiddle.class);
404:
405: /***********************
406: * Set Defaults
407: ***********************/
408: //-- disable drawing of invalid polygons by default (can be changed during work in EditOptionsPanel)
409: workbenchContext.getBlackboard().put(
410: EditTransaction.ROLLING_BACK_INVALID_EDITS_KEY, true);
411:
412: /***********************
413: * testing
414: **********************/
415: /*
416: ProjectionPlugIn projectionPlugin = new ProjectionPlugIn();
417: projectionPlugin.initialize(new PlugInContext(workbenchContext, null, null, null, null));
418: */
419:
420: }
421: }
|