/** * Should we zoom to the geometry when editing starts ? * * @return true when zooming, false otherwise */ public boolean isZoomOnStart() { return delegate.isZoomOnStart(); }
/** * @see #isSnapOnDrag() * @param snapOnDrag */ public void setSnapOnDrag(boolean snapOnDrag) { delegate.setSnapOnDrag(snapOnDrag); }
/** * Should snapping be enabled while inserting ? * * @return true when enabled, false otherwise */ public boolean isSnapOnInsert() { return delegate.isSnapOnInsert(); }
/** * JavaScript constructor. * * @param jsEditor the editor service */ @Export public JsInfoHandler(JsGeometryEditor jsEditor) { editor = jsEditor.getDelegate(); eventBus = new SimpleEventBus(); eventBus.addHandler(InfoDragLineChangedEvent.getType(), this); delegate = new InfoDragLineHandler(editor.getMapWidget(), editor.getEditService(), eventBus); }
/** * JavaScript constructor. * * @param jsEditor the editor service */ @Export public JsInfoHandlerWithHtmlCallback(JsGeometryEditor jsEditor) { editor = jsEditor.getDelegate(); delegate = new InfoDragLineHandlerShowingWindow(editor.getMapWidget(), editor.getEditService()); }
/** * JavaScript constructor. * * @param jsEditor the editor service */ @Export public JsLabelHandler(JsGeometryEditor jsEditor) { editor = jsEditor.getDelegate(); delegate = new LabelDragLineHandler(editor.getMapWidget(), editor.getEditService()) ; }
@Override public GeometryEditor create(MapPresenter mapPresenter) { return new GeometryEditorImpl(mapPresenter, gfxUtil); }
@Override public boolean onCancelClick(ClickEvent event) { // stop editing service if (getGeometryStatus().equals(GeometryStatus.EDITING)) { editor.getEditService().stop(); } setGeometryOfCurrentGroup(null); handler.onCancel(); return true; }
private GeometryStatus getGeometryStatus() { if (editor.getEditService().isStarted() || editor.isBusyEditing() || editor.getEditService().getEditingState().equals(GeometryEditState.INSERTING)) { return GeometryStatus.EDITING; } return geometryOfCurrentGroup == null ? GeometryStatus.NONE : GeometryStatus.ONE; }
/** * Add the list of snapping rules as they are configured for a specific layer within the XML configuration. * * @param layerId The vector layer to use the configuration from. */ public void addLayerSnappingRules(String layerId) { Layer<?> layer = mapWidget.getMapModel().getLayer(layerId); if (layer != null && layer instanceof VectorLayer) { VectorLayer vLayer = (VectorLayer) layer; for (SnappingRuleInfo snappingRuleInfo : vLayer.getLayerInfo().getSnappingRules()) { SnapRuleUtil.addRule(delegate.getSnappingService(), mapWidget, snappingRuleInfo); } } }
/** * Add a new snapping rules to the list. Each new rule provides information on how snapping should occur. * The added rule will use algorithm {@link NearestVertexSnapAlgorithm}. * * @param snapLayer * The layer id that will provide the target geometries where to snap. * @param distance * The maximum distance to bridge during snapping. unit=meters. */ public void addNearestVertexSnappingRule(String snapLayer, double distance) { SnapSourceProvider snapSourceProvider = new VectorLayerSourceProvider(editor.getMapWidget().getMapModel() .getVectorLayer(snapLayer)); delegate.addSnappingRule(new SnappingRule(new NearestVertexSnapAlgorithm(), snapSourceProvider, distance)); }
/** * Is editing busy ? * * @return true when busy, false otherwise */ public boolean isBusyEditing() { return delegate.isBusyEditing(); }
/** * @see #isSnapOnInsert() * @param snapOnInsert */ public void setSnapOnInsert(boolean snapOnInsert) { delegate.setSnapOnInsert(snapOnInsert); }
/** * Should snapping be enabled while dragging ? * * @return true when enabled, false otherwise */ public boolean isSnapOnDrag() { return delegate.isSnapOnDrag(); }
/** * @see #isZoomOnStart() * @param zoomOnStart */ public void setZoomOnStart(boolean zoomOnStart) { delegate.setZoomOnStart(zoomOnStart); }
/** * Constructor, delegate is retreived from {@link JsGeometryEditor}. */ public JsSnapService(JsGeometryEditor editor) { this.editor = editor.getDelegate(); delegate = this.editor.getSnappingService(); }
protected void configure() { install(new GinFactoryModuleBuilder().implement(GeometryEditor.class, GeometryEditorImpl.class).build( GeometryEditorFactory.class)); }
private void onEditingEditGeometry() { if (getGeometryStatus().equals(GeometryStatus.ONE)) { editor.getEditService().start(geometryOfCurrentGroup); //don't show the current geometry, this interferes with editing setGeometryOfCurrentGroup(null); } else { Window.alert(MESSAGES.securityGroupWarningNoGeometryToEdit()); } }
private void onEditingSaveGeometry() { if (getGeometryStatus().equals(GeometryStatus.EDITING)) { setGeometryOfCurrentGroup(editor.getEditService().stop()); } else { updateEditingButtonEnabled(); Window.alert(MESSAGES.securityGroupWarningNoChangesToSave()); } }
private void onEditingDeleteGeometry() { if (getGeometryStatus().equals(GeometryStatus.ONE)) { setGeometryOfCurrentGroup(null); } else { editor.getEditService().stop(); updateEditingButtonEnabled(); Window.alert(MESSAGES.securityGroupWarningNoGeometryToDelete()); } }