コード例 #1
0
  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);
  }
コード例 #2
0
  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));
  }
コード例 #3
0
 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));
 }
コード例 #4
0
 /** @deprecated */
 public SetEditFeatureCommand(EditToolHandler handler, MapMouseEvent e, PrimitiveShape shape) {
   this.handler = handler;
   this.clickPoint = Point.valueOf(e.x, e.y);
   this.shape = shape;
 }