Package org.geomajas.gwt.client.map.feature

Examples of org.geomajas.gwt.client.map.feature.FeatureTransaction


   *            The group where the object resides in (optional).
   * @param context
   *            A MapContext object, responsible for actual drawing.
   */
  public void paint(Paintable paintable, Object group, MapContext context) {
    FeatureTransaction featureTransaction = (FeatureTransaction) paintable;

    Feature[] features = featureTransaction.getNewFeatures();
    if (features == null) {
      return;
    }
    context.getVectorContext().drawGroup(mapWidget.getGroup(RenderGroup.VECTOR), featureTransaction);
    for (int i = 0; i < features.length; i++) {
View Full Code Here


   *
   * @param event
   *            The {@link MenuItemClickEvent} from clicking the action.
   */
  public void onClick(MenuItemClickEvent event) {
    FeatureTransaction featureTransaction = mapWidget.getMapModel().getFeatureEditor().getFeatureTransaction();
    if (featureTransaction != null) {
      controller.cleanup();
      mapWidget.render(featureTransaction,  RenderGroup.VECTOR, RenderStatus.DELETE);
      mapWidget.getMapModel().getFeatureEditor().stopEditing();
    }
View Full Code Here

  // MapController implementation:
  // -------------------------------------------------------------------------


  public void onMouseDown(MouseDownEvent event) {
    FeatureTransaction featureTransaction = getFeatureTransaction();
    if (featureTransaction != null && parent.getEditMode() == EditMode.DRAG_MODE
        && event.getNativeButton() != Event.BUTTON_RIGHT) {
      String targetId = getTargetId(event);
      if (TransactionGeomIndexUtil.isVertex(targetId)) {
        dragTargetId = targetId;
        if (dragTransaction == null) {
          dragTransaction = (FeatureTransaction) featureTransaction.clone();
        }
        mapWidget.render(featureTransaction, RenderGroup.VECTOR, RenderStatus.DELETE);
        mapWidget.render(dragTransaction, RenderGroup.VECTOR, RenderStatus.ALL);
        createTempLine(featureTransaction, event);
      }
View Full Code Here

      }
    }
  }

  public void onMouseMove(MouseMoveEvent event) {
    FeatureTransaction featureTransaction = getFeatureTransaction();
    if (featureTransaction != null && parent.getEditMode() == EditMode.DRAG_MODE && dragTargetId != null) {
      TransactionGeomIndex index = TransactionGeomIndexUtil.getIndex(dragTargetId);

      Feature feature = dragTransaction.getNewFeatures()[index.getFeatureIndex()];
      FeatureOperation op = new SetCoordinateOp(index, getWorldPosition(event));
View Full Code Here

    }
  }

  public void onMouseUp(MouseUpEvent event) {
    if (event.getNativeButton() != Event.BUTTON_RIGHT) {
      FeatureTransaction featureTransaction = getFeatureTransaction();
      if (featureTransaction != null && parent.getEditMode() == EditMode.INSERT_MODE) {
        // The creation of a new point:
        FeatureOperation op = new AddCoordinateOp(getGeometryIndex(), getWorldPosition(event));
        featureTransaction.execute(op);
        mapWidget.render(featureTransaction, RenderGroup.VECTOR, RenderStatus.DELETE);
        mapWidget.render(featureTransaction, RenderGroup.VECTOR, RenderStatus.ALL);
        updateGeometricInfo();
      } else if (featureTransaction != null && parent.getEditMode() == EditMode.DRAG_MODE &&
          dragTargetId != null) {
        // Done dragging a point:
        TransactionGeomIndex index = TransactionGeomIndexUtil.getIndex(dragTargetId);
        // TODO: check validity
        FeatureOperation op = new SetCoordinateOp(index, getWorldPosition(event));
        featureTransaction.execute(op);
        if (dragTransaction != null) {
          mapWidget.render(dragTransaction, RenderGroup.VECTOR, RenderStatus.DELETE);
          dragTransaction = null;
        }
        mapWidget.render(featureTransaction, RenderGroup.VECTOR, RenderStatus.ALL);
View Full Code Here

   *
   * @param event
   *            The {@link MenuItemClickEvent} from clicking the action.
   */
  public void onClick(MenuItemClickEvent event) {
    FeatureTransaction ft = mapWidget.getMapModel().getFeatureEditor().getFeatureTransaction();
    if (ft != null && index != null && coordinate != null) {
      mapWidget.render(ft, RenderGroup.VECTOR, RenderStatus.DELETE);
      InsertCoordinateOp op = new InsertCoordinateOp(index, coordinate);
      ft.execute(op);
      mapWidget.render(ft, RenderGroup.VECTOR, RenderStatus.ALL);
    }
  }
View Full Code Here

   * Implementation of the <code>MenuItemIfFunction</code> interface. This will determine if the menu action should be
   * enabled or not. In essence, this action will be enabled when the context menu event occurred on an edge of the
   * painted <code>FeatureTransaction</code>.
   */
  public boolean execute(Canvas target, Menu menu, MenuItem item) {
    FeatureTransaction featureTransaction = mapWidget.getMapModel().getFeatureEditor().getFeatureTransaction();
    if (featureTransaction != null) {
      MenuContext graphics = mapWidget.getMenuContext();
      coordinate = mapWidget.getMapModel().getMapView().getWorldViewTransformer().viewToWorld(
          graphics.getRightButtonCoordinate());
      String targetId = graphics.getRightButtonName();
View Full Code Here

   *
   * @param event
   *            The {@link MenuItemClickEvent} from clicking the action.
   */
  public void onClick(MenuItemClickEvent event) {
    final FeatureTransaction ft = mapWidget.getMapModel().getFeatureEditor().getFeatureTransaction();
    if (ft != null) {
      SimpleFeatureAttributeWindow window = new SimpleFeatureAttributeWindow(ft.getNewFeatures()[0]) {

        public void onOk(Feature feature) {
          // Copy the attributes to the real feature:
          // Don't overwrite the feature itself, as the GraphicsContext expects the same object for rendering!
          ft.getNewFeatures()[0].setAttributes(feature.getAttributes());
        }

        public void onClose() {
        }
      };
View Full Code Here

  // -------------------------------------------------------------------------
  // MapController implementation:
  // -------------------------------------------------------------------------

  public void onMouseDown(MouseDownEvent event) {
    FeatureTransaction featureTransaction = getFeatureTransaction();
    if (featureTransaction != null && parent.getEditMode() == EditMode.DRAG_MODE
        && event.getNativeButton() != Event.BUTTON_RIGHT) {
      String targetId = getTargetId(event);
      if (TransactionGeomIndexUtil.isVertex(targetId)) {
        dragTargetId = targetId;
        if (dragTransaction == null) {
          dragTransaction = (FeatureTransaction) featureTransaction.clone();
        }
        mapWidget.render(featureTransaction, RenderGroup.VECTOR, RenderStatus.DELETE);
        mapWidget.render(dragTransaction, RenderGroup.VECTOR, RenderStatus.ALL);
        createTempLines(featureTransaction, event);
      }
View Full Code Here

      }
    }
  }

  public void onMouseMove(MouseMoveEvent event) {
    FeatureTransaction featureTransaction = getFeatureTransaction();
    if (featureTransaction != null && parent.getEditMode() == EditMode.DRAG_MODE && dragTargetId != null) {
      TransactionGeomIndex index = TransactionGeomIndexUtil.getIndex(dragTargetId);

      Feature feature = dragTransaction.getNewFeatures()[index.getFeatureIndex()];
      FeatureOperation op = new SetCoordinateOp(index, getWorldPosition(event));
View Full Code Here

TOP

Related Classes of org.geomajas.gwt.client.map.feature.FeatureTransaction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.