Examples of MapWidget


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

    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

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

    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

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

    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);

    IButton butSwitch = new IButton(I18nProvider.getSampleMessages().switchUnitTypes());
    butSwitch.setWidth100();
    buttonLayout.addMember(butSwitch);

    butSwitch.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {

        if (map.getMapModel().getMapInfo().getDisplayUnitType() == UnitType.METRIC) {
          SC.say(I18nProvider.getSampleMessages().unitTypeEnglish());
          map.getMapModel().getMapInfo().setDisplayUnitType(UnitType.ENGLISH); // set English
        } else {
          SC.say(I18nProvider.getSampleMessages().unitTypeMetric());
          map.getMapModel().getMapInfo().setDisplayUnitType(UnitType.METRIC); // set Metric
        }
        map.setScalebarEnabled(false); // force an update of the scale-bar...
        map.setScalebarEnabled(true); // force an update of the scale-bar...
      }
    });

    layout.addMember(mapLayout);
    layout.addMember(buttonLayout);
View Full Code Here

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

    // Map with ID duisburgMap is defined in the XML configuration. (mapDuisburg.xml)
    final VLayout mapLayout = new VLayout();
    mapLayout.setShowEdges(true);
    mapLayout.setHeight("60%");
    map = new MapWidget("mapToolbarSecurity", "gwt-samples");
    map.setController(new PanController(map));
    toolbar = new Toolbar(map);
    mapLayout.addMember(toolbar);
    mapLayout.addMember(map);

    // Create horizontal layout for login buttons:
    HLayout buttonLayout = new HLayout();
    buttonLayout.setMembersMargin(10);

    // Create login handler that re-initializes the map on a successful login:
    final BooleanCallback initMapCallback = new BooleanCallback() {

      public void execute(Boolean value) {
        if (value) {
          toolbar.destroy();
          map.destroy();
          map = new MapWidget("mapToolbarSecurity", "gwt-samples");
          toolbar = new Toolbar(map);
          mapLayout.addMember(toolbar);
          mapLayout.addMember(map);
        }
      }
View Full Code Here

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

    mainLayout.setHeight100();

    // Build a map, and set a PanController:
    VLayout mapLayout = new VLayout();
    mapLayout.setShowEdges(true);
    final MapWidget map = new MapWidget("mapLegend", "gwt-samples");
    map.setController(new PanController(map));
    mapLayout.addMember(map);

    // Layer order panel:
    VLayout orderLayout = new VLayout(10);
    orderLayout.setHeight(80);
    orderLayout.setShowEdges(true);

    orderLayout.addMember(new HTMLFlow(I18nProvider.getSampleMessages().layerOrderTxt()));

    HLayout buttonLayout = new HLayout(5);
    buttonLayout.setPadding(10);

    IButton upButton = new IButton(I18nProvider.getSampleMessages().layerOrderUpBtn());
    upButton.setWidth(150);
    upButton.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        VectorLayer layer = (VectorLayer) map.getMapModel().getLayer("clientLayerCountries110m");
        map.getMapModel().moveVectorLayerUp(layer);
      }
    });
    buttonLayout.addMember(upButton);
    IButton downutton = new IButton(I18nProvider.getSampleMessages().layerOrderDownBtn());
    downutton.setWidth(150);
    downutton.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        VectorLayer layer = (VectorLayer) map.getMapModel().getLayer("clientLayerCountries110m");
        map.getMapModel().moveVectorLayerDown(layer);
      }
    });
    buttonLayout.addMember(downutton);
    orderLayout.addMember(buttonLayout);
    orderLayout.setShowResizeBar(true);
View Full Code Here

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

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

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

    // Create a layout with a FeatureListGrid in it:
    final FeatureListGrid grid = new FeatureListGrid(map.getMapModel());
    grid.setShowEdges(true);
    grid.setShowResizeBar(true);

    // Add a trigger to fill the grid when the map has finished loading:

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

      public void onMapModelChange(MapModelEvent event) {
        final VectorLayer layer = map.getMapModel().getVectorLayer("clientLayerCountries110mGrid");
        grid.setLayer(layer);
        SearchFeatureRequest searchFeatureRequest = new SearchFeatureRequest();
        searchFeatureRequest.setCrs(map.getMapModel().getCrs());
        searchFeatureRequest.setFeatureIncludes(GeomajasConstant.FEATURE_INCLUDE_ATTRIBUTES);
        searchFeatureRequest.setLayerId("layerCountries110m");
        GwtCommand searchCommand = new GwtCommand(SearchFeatureRequest.COMMAND);
        searchCommand.setCommandRequest(searchFeatureRequest);
View Full Code Here

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

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

    // Map with ID editLineLayerMap is defined in the XML configuration.
    final MapWidget map = new MapWidget("mapEditLine", "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("clientLayerEditableRoadtrl020"));
        map.registerMapAddon(new GoogleAddon("google", map, GoogleAddon.MapType.SATELLITE, false));
      }
    });

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

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

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

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

    /**
     * Define a AbstractCircleController that calculates the size of the selected area and outputs it.
     *
     * @author Pieter De Graef
     */
    class CircleAreaController extends AbstractCircleController {

      public CircleAreaController(MapWidget mapWidget) {
        super(mapWidget);
      }

      /** onMouseUp: calculate circle area, and print it. */
      protected void onCircleReady() {
        // Get the circle radius in map units, and calculate the area:
        double radius = getWorldRadius();
        double circleArea = Math.PI * radius * radius;

        // Transform the area from map units, to a readable format (km, mile, ...)
        String area = DistanceFormat.asMapLength(map, circleArea);
        SC.say(I18nProvider.getSampleMessages().circleControllerOutput(area));
      }
    }

    // Apply the CircleAreaController onto the map:
    map.setController(new CircleAreaController(map));

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

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

    // Switch off lazy loading, we want to get everything at once
    GwtCommandDispatcher.getInstance().setUseLazyLoading(false);

    // Create a map with the African countries and make it invisible:
    final MapWidget map = new MapWidget("mapFeatureListGrid", "gwt-samples");
    map.setVisible(false);
    layout.addMember(map);
    map.init();

    // Create a layout with a FeatureListGrid in it:
    final FeatureListGrid grid = new FeatureListGrid(map.getMapModel());
    grid.setShowEdges(true);

    // Create a search widget that displays it's results in the FeatureListGrid:
    final FeatureSearch search = new FeatureSearch(map.getMapModel(), true);
    search.addSearchHandler(new DefaultSearchHandler(grid) {

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

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

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

    // Map with ID editPolygonLayerMap is defined in the XML configuration.
    final MapWidget map = new MapWidget("mapEditMultiPolygon", "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("clientLayerEditableMultiPolygon"));
      }
    });

    // Create a tool-bar for this map:
    final Toolbar toolbar = new Toolbar(map);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.