public boolean execute(final PlugInContext context) throws Exception { reportNothingToUndoYet(context); // Don't add GeometryInfoFrame because the HTML will probably be too // much for the editor pane (too many features). [Bob Boseko] final ViewAttributesFrame frame = new ViewAttributesFrame(context.getSelectedLayer(0), context); context.getWorkbenchFrame().addInternalFrame(frame); return true; }
public void initialize(PlugInContext context) throws Exception { FeatureInstaller featureInstaller = new FeatureInstaller(context.getWorkbenchContext()); featureInstaller.addMainMenuItem( this, new String[] {MenuNames.TOOLS, MenuNames.TOOLS_ANALYSIS}, new JMenuItem(this.getName() + "..."), createEnableCheck(context.getWorkbenchContext())); }
public ViewAttributesFrame(final Layer layer, final PlugInContext context) { this.layerManager = context.getLayerManager(); addInternalFrameListener( new InternalFrameAdapter() { public void internalFrameClosed(InternalFrameEvent e) { // Assume that there are no other views on the model [Jon // Aquino] attributeTab.getModel().dispose(); } }); setResizable(true); setClosable(true); setMaximizable(true); setIconifiable(true); getContentPane().setLayout(new BorderLayout()); attributeTab = new OneLayerAttributeTab( context.getWorkbenchContext(), ((TaskFrameProxy) context.getActiveInternalFrame()).getTaskFrame(), this) .setLayer(layer); addInternalFrameListener( new InternalFrameAdapter() { public void internalFrameOpened(InternalFrameEvent e) { attributeTab.getToolBar().updateEnabledState(); } }); getContentPane().add(attributeTab, BorderLayout.CENTER); setSize(500, 300); updateTitle(attributeTab.getLayer()); context .getLayerManager() .addLayerListener( new LayerListener() { public void layerChanged(LayerEvent e) { if (attributeTab.getLayer() != null) { updateTitle(attributeTab.getLayer()); } // Layer REMOVE [mmichaud 2012-01-05] if (e.getType() == LayerEventType.REMOVED) { if (e.getLayerable() == attributeTab.getLayer()) { attributeTab.getModel().dispose(); context.getLayerManager().removeLayerListener(this); context.getWorkbenchFrame().removeInternalFrame(ViewAttributesFrame.this); dispose(); } } } public void categoryChanged(CategoryEvent e) {} public void featuresChanged(FeatureEvent e) {} }); Assert.isTrue( !(this instanceof CloneableInternalFrame), I18N.get("ui.plugin.ViewAttributesPlugIn.there-can-be-no-other-views-on-the-InfoModels")); }
public void run(TaskMonitor monitor, PlugInContext context) throws Exception { FeatureCollection a = dialog.getLayer(LAYER).getFeatureCollectionWrapper(); FeatureCollection hullFC = convexHhull(monitor, a); if (hullFC == null) { return; } context.getLayerManager().addCategory(categoryName); context.addLayer( categoryName, I18N.get("ui.plugin.analysis.ConvexHullPlugIn.Convex-Hull"), hullFC); }
public double[] isSelected(int[] screenCoordTest, AbstractDrawer draw) { for (int i = 0; i < XY.length; i++) { int[] screenCoord = draw.project(XY[i]); if ((screenCoord[0] + note_precision > screenCoordTest[0]) && (screenCoord[0] - note_precision < screenCoordTest[0]) && (screenCoord[1] + note_precision > screenCoordTest[1]) && (screenCoord[1] - note_precision < screenCoordTest[1])) { // System.out.println("fid of selected point: " + pointId[i]); List features = layer.getFeatureCollectionWrapper().getFeatures(); Feature selFeature = null; for (Iterator iter = features.iterator(); iter.hasNext(); ) { Feature f = (Feature) iter.next(); if (pointId[i] == f.getID()) { selFeature = f; } } // context.getLayerViewPanel().getSelectionManager().clear(); // context.getLayerViewPanel().getSelectionManager().getFeatureSelection().selectItems(layer, selFeature); Collection clickedFeatures = new ArrayList(); clickedFeatures.add(selFeature); try { zoomToSelectedItemsPlugIn.flash( FeatureUtil.toGeometries(clickedFeatures), context.getLayerViewPanel()); } catch (Throwable t) { context.getWorkbenchContext().getErrorHandler().handleThrowable(t); } // -- [sstein] modified to print FID as label // but this results with problems in AbstractDrawer.drawCoordinate() // since it will try to set the axes using the FID as well. /* double[] vals; if (pointId !=null){ vals = new double[3]; vals[0] = XY[i][0]; vals[1] = XY[i][1]; vals[2] = pointId[i]; } else{ vals = XY[i]; } return vals; */ return XY[i]; } } return null; }
private void initDialog(PlugInContext context) { dialog = new MultiInputDialog( context.getWorkbenchFrame(), I18N.get("ui.plugin.analysis.ConvexHullPlugIn.Convex-Hull-on-Layer"), true); // dialog.setSideBarImage(IconLoader.icon("Overlay.gif")); dialog.setSideBarDescription( I18N.get( "ui.plugin.analysis.ConvexHullPlugIn.Creates-a-new-layer-containing-the-convex-hull-of-all-the-features-in-the-source-layer")); String fieldName = LAYER; JComboBox addLayerComboBox = dialog.addLayerComboBox( fieldName, context.getCandidateLayer(0), null, context.getLayerManager()); GUIUtil.centreOnWindow(dialog); }
public void updateLegend(PlugInContext context, I18NPlug iPlug) { Vector<LegendElement> tempItems = new Vector<>(10, 5); boolean showLine; boolean showFill; if (iPlug != null && legendName == null) { legendName = iPlug.get("JumpPrinter.Furniture.Legend"); } this.iPlug = iPlug; if (legendItems != null) { for (int i = 0; i < legendItems.size(); i++) { tempItems.addElement(legendItems.elementAt(i)); } } legendItems = new Vector<LegendElement>(10, 5); java.util.List layerCollection = context.getLayerViewPanel().getLayerManager().getVisibleLayers(true); Iterator i = layerCollection.iterator(); int count = 0; while (i.hasNext()) { Layer layer = (Layer) i.next(); String name = layer.getName(); String desc = layer.getDescription(); if (debug) { System.out.println("layer " + count + ":" + name + "," + desc); } BasicStyle basicStyle = layer.getBasicStyle(); VertexStyle vertexStyle = layer.getVertexStyle(); Collection themeStyles = null; ColorThemingStyle themeStyle = (ColorThemingStyle) layer.getStyle(ColorThemingStyle.class); if (debug) { System.out.println(" Theming enabled: " + themeStyle.isEnabled()); } if (themeStyle.isEnabled()) { Map themeMap = themeStyle.getAttributeValueToBasicStyleMap(); if (debug) { System.out.println("Map:" + themeMap.toString()); } themeStyles = themeMap.values(); } int alpha = basicStyle.getAlpha(); Color lineColor = basicStyle.getLineColor(); lineColor = new Color(lineColor.getRed(), lineColor.getGreen(), lineColor.getBlue(), alpha); showLine = true; if (!basicStyle.isRenderingLine()) { showLine = false; } Color fillColor = basicStyle.getFillColor(); fillColor = new Color(fillColor.getRed(), fillColor.getGreen(), fillColor.getBlue(), alpha); showFill = true; if (!basicStyle.isRenderingFill()) { showFill = false; } Stroke lineStroke = basicStyle.getLineStroke(); Paint fillPattern = basicStyle.getFillPattern(); if (!basicStyle.isRenderingFillPattern()) { fillPattern = null; } // System.out.println(" LineColor: "+basicStyle.getLineColor()+" // FillColor:"+basicStyle.getFillColor()); // create new legend item, include by default LegendElement legendElement = new LegendElement( true, name, lineColor, lineStroke, fillColor, fillPattern, themeStyles, null, vertexStyle, showLine, showFill); // set include on existing items for (int k = 0; k < tempItems.size(); k++) { LegendElement anitem = tempItems.elementAt(k); if (anitem.name.equals(legendElement.name)) { legendElement.include = anitem.include; } } legendItems.addElement(legendElement); if (debug) { System.out.println(legendElement.toString()); } count++; } }