Package org.geomajas.gwt.client.widget

Examples of org.geomajas.gwt.client.widget.MapWidget


    layout.setMembersMargin(10);
    layout.setWidth100();
    layout.setHeight100();

    // Map with ID beansMap is defined in the XML configuration. (contains any type of attribute)
    final MapWidget map = new MapWidget("mapBeansAssociation", "gwt-samples");
    map.setVisible(false);
    layout.addMember(map);
    map.init();

    HLayout hLayout = new HLayout(10);
    hLayout.setHeight(40);
    IButton disabledBtn = new IButton("Disable form");
    disabledBtn.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        editor.setDisabled(true);
      }
    });
    hLayout.addMember(disabledBtn);
    IButton enabledBtn = new IButton("Enable form");
    enabledBtn.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        editor.setDisabled(false);
      }
    });
    hLayout.addMember(enabledBtn);
    layout.addMember(hLayout);

    map.getMapModel().addMapModelHandler(new MapModelHandler() {

      public void onMapModelChange(MapModelEvent event) {
        VectorLayer layer = (VectorLayer) map.getMapModel().getLayer("beansAssociationLayer");
        editor = new FeatureAttributeEditor(layer, false);
        editor.setWidth(400);
        layout.addMember(editor);
      }
    });
View Full Code Here


    VLayout layout = new VLayout();
    layout.setWidth100();
    layout.setHeight100();

    // Map with ID wmsMap is defined in the XML configuration. (mapWms.xml)
    final MapWidget map = new MapWidget("mapWms", "gwt-samples");
    map.addDrawHandler(new DrawHandler() {

      public void onDraw(DrawEvent event) {
        AreaController areaController = new AreaController(map);
        map.setController(areaController);
      }
    });

    layout.addMember(map);
    return layout;
View Full Code Here

    VLayout mapLayout = new VLayout();
    mapLayout.setShowEdges(true);
    mapLayout.setShowResizeBar(true);

    // Map with ID editPointLayerMap is defined in the XML configuration.
    final MapWidget map = new MapWidget("mapEditPoint", "gwt-samples");
    map.getMapModel().addMapModelHandler(new MapModelHandler() {

      // When the map is initialized: select the cities layer - so that new features are created in this layer:
      public void onMapModelChange(MapModelEvent event) {
        map.getMapModel().selectLayer(map.getMapModel().getLayer("clientLayerEditableAirports"));
      }
    });

    // Create a toolbar for this map:
    final Toolbar toolbar = new Toolbar(map);
View Full Code Here

    VLayout layout = new VLayout();
    layout.setWidth100();
    layout.setHeight100();

    // Map with ID wmsMap is defined in the XML configuration. (mapWms.xml)
    final MapWidget map = new MapWidget("mapWms", "gwt-samples");

    // Set a panning controller on the map:
    map.setController(new PanController(map));
    layout.addMember(map);

    return layout;
  }
View Full Code Here

    VLayout layout = new VLayout();
    layout.setWidth100();
    layout.setHeight100();

    // Create the map, using the wmsMap configuration (mapOsm.xml):
    final MapWidget map = new MapWidget("mapOsm", "gwt-samples");

    VLayout mapLayout = new VLayout();
    mapLayout.setShowEdges(true);
    mapLayout.setHeight("60%");
    mapLayout.addMember(map);

    VLayout labelLayout = new VLayout();
    final Label label = new Label();
    labelLayout.addMember(label);

    /**
     * Listener implementation that prints out the mouse position.
     *
     * @author Pieter De Graef
     */
    class MouseMoveListener extends AbstractListener {

      public void onMouseMove(ListenerEvent event) {
        Coordinate screenPosition = event.getScreenPosition();
        Coordinate worldPosition = event.getWorldPosition();
        String x = NumberFormat.getFormat("0.000").format(worldPosition.getX());
        String y = NumberFormat.getFormat("0.000").format(worldPosition.getY());
        label.setContents(I18nProvider.getSampleMessages().customControllerScreenCoordinates() + " = "
            + screenPosition + "<br/>"
            + I18nProvider.getSampleMessages().customControllerWorldCoordinates() + " = (" + x + ", " + y
            + ")");
      }
    }
    map.addListener(new MouseMoveListener());

    layout.addMember(mapLayout);
    layout.addMember(labelLayout);

    return layout;
View Full Code Here

    layout.setMembersMargin(10);
    layout.setWidth100();
    layout.setHeight100();

    // Map with ID beansMap is defined in the XML configuration. (contains any type of attribute)
    final MapWidget map = new MapWidget("mapBeansIncludeInForm", "gwt-samples");
    map.setVisible(false);
    layout.addMember(map);
    map.init();

    map.getMapModel().addMapModelHandler(new MapModelHandler() {

      public void onMapModelChange(MapModelEvent event) {
        VectorLayer layer = (VectorLayer) map.getMapModel().getLayer("beansLayerIncludeInForm");
        FeatureAttributeEditor editor = new FeatureAttributeEditor(layer, false);
        editor.setWidth(400);
        layout.addMember(editor);
      }
    });
View Full Code Here

    VLayout layout = new VLayout();
    layout.setWidth100();
    layout.setHeight100();

    // Map with ID mapOsm is defined in the XML configuration. (mapOsm.xml)
    final MapWidget map = new MapWidget("mapOsm", "gwt-samples");

    // Set a panning controller on the map:
    map.setController(new PanController(map));
    layout.addMember(map);
    return layout;
  }
View Full Code Here

    VLayout mapLayout = new VLayout();
    mapLayout.setShowEdges(true);
    mapLayout.setHeight("60%");

    // Map with ID wmsMap is defined in the XML configuration. (mapWms.xml)
    final MapWidget map = new MapWidget("mapWms", "gwt-samples");
    mapLayout.addMember(map);

    VLayout labelLayout = new VLayout();
    final Label label = new Label();
    labelLayout.addMember(label);

    // Create the custom controller:
    GraphicsController customController = new AbstractGraphicsController(map) {
     
      public void onMouseMove(MouseMoveEvent event) {
        Coordinate screenPosition = getScreenPosition(event);
        Coordinate worldPosition = getWorldPosition(event);
        String x = NumberFormat.getFormat("0.000").format(worldPosition.getX());
        String y = NumberFormat.getFormat("0.000").format(worldPosition.getY());
        label.setContents(I18nProvider.getSampleMessages().customControllerScreenCoordinates() + " = "
            + screenPosition + "<br/>"
            + I18nProvider.getSampleMessages().customControllerWorldCoordinates()
            + " = (" + x + ", " + y + ")");
      }

    };

    // Set the controller on the map:
    map.setController(customController);

    layout.addMember(mapLayout);
    layout.addMember(labelLayout);
    return layout;
  }
View Full Code Here

    VLayout layout = new VLayout();
    layout.setWidth100();
    layout.setHeight100();

    // Map with ID geotoolsMap is defined in the XML configuration. (mapGeoTools.xml)
    final MapWidget map = new MapWidget("mapGeotools", "gwt-samples");

    // Set a panning controller on the map:
    map.setController(new PanController(map));
    layout.addMember(map);

    return layout;
  }
View Full Code Here

    HLayout mapLayout = new HLayout();
    mapLayout.setShowEdges(true);
    mapLayout.setHeight("60%");

    // Map with ID mapOsm is defined in the XML configuration. (mapOsm.xml)
    final MapWidget map = new MapWidget("mapOsm", "gwt-samples");
    map.setController(new PanController(map));
    mapLayout.addMember(map);

    HLayout buttonLayout = new HLayout();
    buttonLayout.setMembersMargin(10);

    // Create a button to toggle bounds between the whole world an Belgium
    final IButton butToggleMaxBounds = new IButton(I18nProvider.getSampleMessages().toggleMaxBoundsBelgium());
    butToggleMaxBounds.setWidth100();
    buttonLayout.addMember(butToggleMaxBounds);

    butToggleMaxBounds.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        if (isBelgiumBoundsEnabled) { // switch to whole world bounds
          isBelgiumBoundsEnabled = false;
          map.getMapModel().getMapView().setMaxBounds(maxBounds);
          butToggleMaxBounds.setTitle(I18nProvider.getSampleMessages().toggleMaxBoundsBelgium());
        } else { // switch to Belgium bounds
          if (maxBounds == null) {
            // First we save the World bounds:
            maxBounds = map.getMapModel().getMapView().getMaxBounds();
          }
         
          map.getMapModel().getMapView().setMaxBounds(belgiumBounds);
          // force a new scale level so we go inside the bounding box of Belgium
          map.getMapModel().getMapView().applyBounds(belgiumBounds, ZoomOption.LEVEL_FIT);
          isBelgiumBoundsEnabled = true;
          butToggleMaxBounds.setTitle(I18nProvider.getSampleMessages().toggleMaxBoundsWorld());
        }
      }
    });
View Full Code Here

TOP

Related Classes of org.geomajas.gwt.client.widget.MapWidget

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.