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

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


   *
   * @param event
   *            The {@link MenuItemClickEvent} from clicking the action.
   */
  public void onClick(MenuItemClickEvent event) {
    FeatureTransaction featureTransaction = mapModel.getFeatureEditor().getFeatureTransaction();
    if (featureTransaction != null) {
      List<Activity> activities = new ArrayList<Activity>();
      activities.add(new ValidationActivity());
      activities.add(new CommitActivity());
      WorkflowProcessor processor = new SequenceProcessor(new MapModelWorkflowContext());
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) {
      mapWidget.render(ft, RenderGroup.VECTOR, RenderStatus.DELETE);
      RemoveCoordinateOp op = new RemoveCoordinateOp(index);
      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 a vertex 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();
      String targetId = graphics.getRightButtonName();
      if (targetId != null && TransactionGeomIndexUtil.isVertex(targetId)) {
        index = TransactionGeomIndexUtil.getIndex(targetId);
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) {
      mapWidget.render(ft, RenderGroup.VECTOR, RenderStatus.DELETE);
      RemoveRingOp op = new RemoveRingOp(index);
      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 the area of a
   * polygon's interior ring.
   */
  public boolean execute(Canvas target, Menu menu, MenuItem item) {
    FeatureTransaction featureTransaction = mapWidget.getMapModel().getFeatureEditor().getFeatureTransaction();
    if (featureTransaction != null) {
      MenuContext graphics = mapWidget.getMenuContext();
      String targetId = graphics.getRightButtonName();
      if (targetId != null && TransactionGeomIndexUtil.isInteriorRing(targetId, true)) {
        index = TransactionGeomIndexUtil.getIndex(targetId);
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 && index != null) {
      List<Feature> features = new ArrayList<Feature>();
      features.add(ft.getNewFeatures()[index.getFeatureIndex()]);
      LazyLoader.lazyLoad(features, GeomajasConstant.FEATURE_INCLUDE_GEOMETRY, new LazyLoadCallback() {

        public void execute(List<Feature> response) {
          controller.setEditMode(EditMode.INSERT_MODE);
          Geometry geometry = response.get(0).getGeometry();
          if (geometry instanceof Polygon) {
            geometry = addRing((Polygon) geometry);
          } else if (geometry instanceof MultiPolygon) {
            geometry = addRing((MultiPolygon) geometry);
          }
          ft.getNewFeatures()[index.getFeatureIndex()].setGeometry(geometry);
          controller.setGeometryIndex(index);
          controller.hideGeometricInfo();
        }
      });
    }
View Full Code Here

   *            Expects a {@link MapModelWorkflowContext}.
   */
  public WorkflowContext execute(WorkflowContext context) throws WorkflowException {
    if (context instanceof MapModelWorkflowContext) {
      MapModelWorkflowContext mmContext = (MapModelWorkflowContext) context;
      FeatureTransaction ft = mmContext.getFeatureTransaction();
      if (ft.getNewFeatures() != null) {
        for (Feature feature : ft.getNewFeatures()) {
          if (!feature.getGeometry().isValid()) {
            throw new WorkflowException(I18nProvider.getGlobal().validationActivityError());
          }
        }
      }
View Full Code Here

  public WorkflowContext execute(WorkflowContext context) throws WorkflowException {
    if (context instanceof MapModelWorkflowContext) {
      MapModelWorkflowContext mmc = (MapModelWorkflowContext) context;
      final MapModel mapModel = mmc.getMapModel();
      final FeatureTransaction ft = mmc.getFeatureTransaction();

      PersistTransactionRequest request = new PersistTransactionRequest();
      request.setFeatureTransaction(ft.toDto());
      request.setCrs(mapModel.getCrs());

      GwtCommand command = new GwtCommand(PersistTransactionRequest.COMMAND);
      command.setCommandRequest(request);

      GwtCommandDispatcher.getInstance().execute(command, new CommandCallback() {

        public void execute(CommandResponse response) {
          if (response instanceof PersistTransactionResponse) {
            PersistTransactionResponse ptr = (PersistTransactionResponse) response;
            mapModel.applyFeatureTransaction(new FeatureTransaction(ft.getLayer(), ptr
                .getFeatureTransaction()));
          }
        }
      });
    }
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.