Package org.geomajas.gwt.client.widget

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


    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


    // 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

    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

    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

    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

    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

    // 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

    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

    // Create map with OSM layer, and add a PanController to it:
    VLayout mapLayout = new VLayout();
    mapLayout.setShowEdges(true);
    mapLayout.setHeight("60%");

    final MapWidget map = new MapWidget("mapOsm", "gwt-samples");
    map.setController(new PanController(map));
    mapLayout.addMember(map);

    // Create a button layout:
    HLayout buttonLayout = new HLayout();
    buttonLayout.setHeight(25);
    buttonLayout.setMembersMargin(10);
    IButton button1 = new IButton(I18nProvider.getSampleMessages().screenWorldBTNScreen());
    button1.setWidth("50%");

    final Image screenImage = new Image("imageInScreenSpace");
    screenImage.setHref(Geomajas.getIsomorphicDir() + "geomajas/example/images/smile.png");
    screenImage.setBounds(new Bbox(60, 60, 48, 48)); // Pixel coordinates
    screenImage.setStyle(new PictureStyle(0.6));

    button1.addClickHandler(new ClickHandler() {

      // Draw an image in screen space:
      public void onClick(ClickEvent event) {
        map.render(screenImage, RenderGroup.SCREEN, RenderStatus.ALL);
      }
    });
    buttonLayout.addMember(button1);

    IButton button2 = new IButton(I18nProvider.getSampleMessages().screenWorldBTNWorld());
    button2.setWidth("50%");

    // An image
    final Image worldImage = new Image("imageInWorldSpace");
    worldImage.setHref(Geomajas.getIsomorphicDir() + "geomajas/example/images/smile.png");
    worldImage.setBounds(new Bbox(-2000000, -2000000, 4000000, 4000000)); // Mercator coordinates
    worldImage.setStyle(new PictureStyle(0.8));

    // And some geometries
    final GfxGeometry worldGeometry = new GfxGeometry("MultiPolygonInWorldSpace");
    final GeometryFactory gf = new GeometryFactory(map.getMapModel().getSrid(), map.getMapModel().getPrecision());
    Polygon p1 = gf.createPolygon(gf.createLinearRing(new Bbox(10000000d, 1000d, 1000000d, 1000000d)), null);
    Polygon p2 = gf.createPolygon(gf.createLinearRing(new Bbox(12000000d, 1000d, 500000d, 500000d)), null);
    MultiPolygon mp = gf.createMultiPolygon(new Polygon[] {p1, p2});
    worldGeometry.setStyle(new ShapeStyle("#FF0000", 0.5f, "#FF0000", 1.0f, 2));
    worldGeometry.setGeometry(mp);

    final GfxGeometry worldGeometry2 = new GfxGeometry("MultiPointInWorldSpace");
    SymbolInfo si = new SymbolInfo();
    CircleInfo ci = new CircleInfo();
    ci.setR(8.0f);
    si.setCircle(ci);
    Point pt1 = gf.createPoint(new Coordinate(6000000, -5000000));
    Point pt2 = gf.createPoint(new Coordinate(8000000, -5000000));
    Point pt3 = gf.createPoint(new Coordinate(7000000, -7000000));
    worldGeometry2.setStyle(new ShapeStyle("#0000FF", 0.3f, "#0000FF", 1.0f, 2));
    worldGeometry2.setGeometry(gf.createMultiPoint(new Point[] {pt1, pt2, pt3}));
    worldGeometry2.setSymbolInfo(si);

    button2.addClickHandler(new ClickHandler() {

      // Draw an image and some geometries in world space:
      public void onClick(ClickEvent event) {
        map.registerWorldPaintable(worldImage);
        map.registerWorldPaintable(worldGeometry);
        map.registerWorldPaintable(worldGeometry2);
      }
    });
    buttonLayout.addMember(button2);

    // Create a second button layout (delete buttons):
    HLayout buttonLayout2 = new HLayout();
    buttonLayout2.setMembersMargin(10);
    IButton button3 = new IButton(I18nProvider.getSampleMessages().screenWorldBTNScreenDelete());
    button3.setWidth("50%");
    button3.addClickHandler(new ClickHandler() {

      // Delete the image in screen space:
      public void onClick(ClickEvent event) {
        map.render(screenImage, RenderGroup.SCREEN, RenderStatus.DELETE);
      }
    });
    buttonLayout2.addMember(button3);

    IButton button4 = new IButton(I18nProvider.getSampleMessages().screenWorldBTNWorldDelete());
    button4.setWidth("50%");
    button4.addClickHandler(new ClickHandler() {

      // Delete the image and geometries in world space:
      public void onClick(ClickEvent event) {
        map.unregisterWorldPaintable(worldImage);
        map.unregisterWorldPaintable(worldGeometry);
        map.unregisterWorldPaintable(worldGeometry2);
      }
    });
    buttonLayout2.addMember(button4);

    // Place both in the 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("mapToolbarSecurity", "gwt-samples");
    final Toolbar toolbar = new Toolbar(map);
    toolbar.setButtonSize(Toolbar.BUTTON_SIZE_BIG);

    // Set a different fall-back controller:
    map.setFallbackController(new MeasureDistanceController(map));

    mapLayout.addMember(toolbar);
    mapLayout.addMember(map);

    VLayout labelLayout = new VLayout();
View Full Code Here

TOP

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

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.