public Rectangle getValidArea() { int a = frame * 4; int c = (int) Math.sqrt(a * a + a * a); int x = center.getX(); int y = center.getY(); return new Rectangle(x - c, y - c, c + c, c + c); }
public void run(IProgressMonitor monitor) throws Exception { graphics.setColor(PreferenceUtil.instance().getFeedbackColor()); int a = frame * 4; int c = (int) Math.sqrt(a * a + a * a); int x = center.getX(); int y = center.getY(); int rad = 3; graphics.fill(new Rectangle(x - c, y, rad, rad)); graphics.fill(new Rectangle(x + c, y, rad, rad)); graphics.fill(new Rectangle(x, y + c, rad, rad)); graphics.fill(new Rectangle(x, y - c, rad, rad)); graphics.fill(new Rectangle(x - a, y - a, rad, rad)); graphics.fill(new Rectangle(x + a, y - a, rad, rad)); graphics.fill(new Rectangle(x + a, y + a, rad, rad)); graphics.fill(new Rectangle(x - a, y + a, rad, rad)); }
public void run(IProgressMonitor monitor) throws Exception { IToolContext context = handler.getContext(); java.awt.Point point = new java.awt.Point(clickPoint.getX(), clickPoint.getY()); ReferencedEnvelope bbox = handler.getContext().getBoundingBox(point, 7); FeatureCollection<SimpleFeatureType, SimpleFeature> fc = context.getFeaturesInBbox(handler.getEditLayer(), bbox); FeatureIterator<SimpleFeature> it = fc.features(); SimpleFeature feature = null; while (it.hasNext()) { SimpleFeature feat = it.next(); if (feat.getID().equals(shape.getEditGeom().getFeatureIDRef().toString())) { feature = feat; break; } } it.close(); oldFeature = getMap().getEditManagerInternal().getEditFeature(); oldLayer = getMap().getEditManagerInternal().getEditLayer(); editLayer = (Layer) handler.getEditLayer(); oldFilter = editLayer.getFilter(); getMap().getEditManagerInternal().setEditFeature(feature, editLayer); editLayer.setFilter(fidFilter(feature)); }
/** @deprecated */ public SetEditFeatureCommand(EditToolHandler handler, MapMouseEvent e, PrimitiveShape shape) { this.handler = handler; this.clickPoint = Point.valueOf(e.x, e.y); this.shape = shape; }