Package org.geomajas.gwt.client.widget

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


    buttonLayout.setPadding(10);
    buttonLayout.setShowEdges(true);

    VLayout mapLayout = new VLayout();
    mapLayout.setShowEdges(true);
    final MapWidget map = new MapWidget("mapLegend", "gwt-samples");
    map.setController(new PanController(map));
    mapLayout.addMember(map);

    IButton rasterButton = new IButton("Toggle Raster layer");
    rasterButton.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        Layer<?> layer = map.getMapModel().getLayer("clientLayerWms");
        layer.setVisible(!layer.isShowing());
      }
    });
    rasterButton.setWidth100();
    buttonLayout.addMember(rasterButton);

    IButton lineButton = new IButton("Toggle Line layer");
    lineButton.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        Layer<?> layer = map.getMapModel().getLayer("clientLayerRivers50m");
        layer.setVisible(!layer.isShowing());
      }
    });
    lineButton.setWidth100();
    buttonLayout.addMember(lineButton);

    IButton polygonButton = new IButton("Toggle Polygon layer");
    polygonButton.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        Layer<?> layer = map.getMapModel().getLayer("clientLayerCountries110m");
        layer.setVisible(!layer.isShowing());
      }
    });
    polygonButton.setWidth100();
    buttonLayout.addMember(polygonButton);

    IButton pointButton = new IButton("Toggle Point layer");
    pointButton.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        Layer<?> layer = map.getMapModel().getLayer("clientLayerPopulatedPlaces110m");
        layer.setVisible(!layer.isShowing());
      }
    });
    pointButton.setWidth100();
    buttonLayout.addMember(pointButton);

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

    final Legend legend = new Legend(map.getMapModel());
    legend.setHeight100();
    legend.setWidth100();
    legendLayout.addMember(legend);

    topLayout.addMember(buttonLayout);
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("mapEditableGrid", "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);
    grid.setEditingEnabled(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("clientLayerBeansEditableGrid");
        grid.setLayer(layer);
        SearchFeatureRequest searchFeatureRequest = new SearchFeatureRequest();
        searchFeatureRequest.setCrs(map.getMapModel().getCrs());
        searchFeatureRequest.setFeatureIncludes(GeomajasConstant.FEATURE_INCLUDE_ATTRIBUTES);
        searchFeatureRequest.setLayerId("layerBeansEditableGrid");
        GwtCommand searchCommand = new GwtCommand(SearchFeatureRequest.COMMAND);
        searchCommand.setCommandRequest(searchFeatureRequest);
View Full Code Here

    secondColumn.setMembersMargin(5);
    VLayout thirdColumn = new VLayout();
    thirdColumn.setMembersMargin(5);

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

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

    // Create a button that centers the map to (0,0):
    IButton centerBTN = new IButton(I18nProvider.getSampleMessages().navigationBtnPosition());
    centerBTN.setWidth100();
    centerBTN.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        map.getMapModel().getMapView().setCenterPosition(new Coordinate(-10000000, 2000000));
      }
    });

    // Create a button that translate the map:
    IButton translateBTN = new IButton(I18nProvider.getSampleMessages().navigationBtnTranslate());
    translateBTN.setWidth100();
    translateBTN.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        map.getMapModel().getMapView().translate(1000000, -500000);
      }
    });

    // Create a button that applies a bounding box to zoom to:
    IButton bboxBTN = new IButton(I18nProvider.getSampleMessages().navigationBtnBbox());
    bboxBTN.setWidth100();
    bboxBTN.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        map.getMapModel().getMapView().applyBounds(new Bbox(1200000, 4600000, 1400000, 1400000),
            ZoomOption.EXACT);
      }
    });

    // Create a button that zooms out:
    IButton zoomOutBTN = new IButton(I18nProvider.getSampleMessages().navigationBtnZoomOut());
    zoomOutBTN.setWidth100();
    zoomOutBTN.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        map.getMapModel().getMapView().scale(0.5, ZoomOption.LEVEL_CHANGE);
      }
    });

    // Create a button that zooms in:
    IButton zoomInBTN = new IButton(I18nProvider.getSampleMessages().navigationBtnZoomIn());
    zoomInBTN.setWidth100();
    zoomInBTN.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        map.getMapModel().getMapView().scale(2, ZoomOption.LEVEL_CHANGE);
      }
    });

    firstColumn.addMember(zoomOutBTN);
    firstColumn.addMember(zoomInBTN);
View Full Code Here

  public Canvas getViewPanel() {
    VLayout layout = new VLayout();
    layout.setWidth100();
    layout.setHeight100();

    final MapWidget map = new MapWidget("mapOsm", "gwt-samples");

    final Toolbar toolbar = new Toolbar(map);
    toolbar.setButtonSize(Toolbar.BUTTON_SIZE_BIG);
    final GeocoderWidget geocoderWidget = new GeocoderWidget(map, "description", "Geocoder");
    toolbar.addMember(geocoderWidget);
View Full Code Here

  public Canvas getViewPanel() {
    VLayout layout = new VLayout();
    layout.setWidth100();
    layout.setHeight100();

    final MapWidget map = new MapWidget("mapPrinting", "gwt-samples");

    final Toolbar toolbar = new Toolbar(map);
    toolbar.setButtonSize(Toolbar.BUTTON_SIZE_BIG);

    layout.addMember(toolbar);
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("mapBeansCustomType", "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("beansLayerCustomType");
        FeatureAttributeEditor editor = new FeatureAttributeEditor(layer, false);
        editor.setWidth(400);
        layout.addMember(editor);
      }
    });
View Full Code Here

    layout.setMembersMargin(10);

    // Create map with Google layer, and add a PanController to it:
    VLayout mapLayout1 = new VLayout();
    mapLayout1.setShowEdges(true);
    googleMap = new MapWidget("mapGoogle", "gwt-samples");
    googleMap.setController(new PanController(googleMap));
    mapLayout1.addMember(googleMap);

    // Create map with Google layer (satellite), and add a PanController to it:
    VLayout mapLayout2 = new VLayout();
    mapLayout2.setShowEdges(true);
    googleSatMap = new MapWidget("mapGoogleSat", "gwt-samples");
    googleSatMap.setController(new PanController(googleSatMap));
    mapLayout2.addMember(googleSatMap);

    // Create map with Google layer (terrain), and add a PanController to it:
    VLayout mapLayout3 = new VLayout();
    mapLayout3.setShowEdges(true);
    googleTerrainMap = new MapWidget("mapGoogleTerrain", "gwt-samples");
    googleTerrainMap.setController(new PanController(googleTerrainMap));
    mapLayout3.addMember(googleTerrainMap);

    // Place all three in the layout:
    layout.addMember(mapLayout1);
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("mapEditPolygon", "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("clientLayerEditablePolygon"));
      }
    });

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

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

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

    // Layout with a huge list of buttons to test the rendering:
    HLayout buttonLayout = new HLayout();
    buttonLayout.setPadding(10);
    buttonLayout.setMembersMargin(10);
    VLayout column1 = new VLayout();
    column1.setMembersMargin(10);
    VLayout column2 = new VLayout();
    column2.setMembersMargin(10);
    VLayout column3 = new VLayout();
    column3.setMembersMargin(10);

    final Composite group1 = new Composite("some-group");
    final Composite group2 = new Composite("another-group");

    // Button1: Draw circle
    IButton button1 = new IButton(I18nProvider.getSampleMessages().renderingDrawCircle());
    button1.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        map.getVectorContext().drawGroup(map.getGroup(RenderGroup.SCREEN), group1);
        ShapeStyle style = new ShapeStyle("#66CC22", 0.5f, "#66AA22", 1, 2);
        map.getVectorContext().drawCircle(group1, "circle", new Coordinate(200, 100), 30, style);
      }
    });
    button1.setWidth100();
    column1.addMember(button1);

    // Button2: Draw LineString
    IButton button2 = new IButton(I18nProvider.getSampleMessages().renderingDrawLineString());
    button2.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        map.getVectorContext().drawGroup(map.getGroup(RenderGroup.SCREEN), group2);
        LineString geometry = map.getMapModel().getGeometryFactory().createLineString(
            new Coordinate[] { new Coordinate(60, 20), new Coordinate(120, 80), new Coordinate(80, 100) });
        ShapeStyle style = new ShapeStyle("#994488", 0.0f, "#993388", 1, 2);
        map.getVectorContext().drawLine(group2, "LineString", geometry, style);
      }
    });
    button2.setWidth100();
    column1.addMember(button2);

    // Button3: Draw Polygon
    IButton button3 = new IButton(I18nProvider.getSampleMessages().renderingDrawPolygon());
    button3.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        map.getVectorContext().drawGroup(map.getGroup(RenderGroup.SCREEN), group2);
        GeometryFactory factory = map.getMapModel().getGeometryFactory();
        LinearRing shell = factory.createLinearRing(new Coordinate[] { new Coordinate(110, 10),
            new Coordinate(210, 10), new Coordinate(210, 110), new Coordinate(110, 110),
            new Coordinate(110, 10) });
        LinearRing hole = factory.createLinearRing(new Coordinate[] { new Coordinate(140, 40),
            new Coordinate(170, 40), new Coordinate(170, 70), new Coordinate(140, 70),
            new Coordinate(140, 40) });
        Polygon polygon = factory.createPolygon(shell, new LinearRing[] { hole });
        ShapeStyle style = new ShapeStyle("#9933EE", 0.5f, "#9900FF", 1, 2);
        map.getVectorContext().drawPolygon(group2, "Polygon", polygon, style);
      }
    });
    button3.setWidth100();
    column1.addMember(button3);

    // Button4: Draw Text
    IButton button4 = new IButton(I18nProvider.getSampleMessages().renderingDrawText());
    button4.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        map.getVectorContext().drawGroup(map.getGroup(RenderGroup.SCREEN), group1);
        FontStyle style = new FontStyle("#FF0000", 12, "Verdana", "normal", "normal");
        map.getVectorContext()
            .drawText(group1, "text", "This is some text...", new Coordinate(100, 120), style);
      }
    });
    button4.setWidth100();
    column2.addMember(button4);

    // Button5: Draw Rectangle
    IButton button5 = new IButton(I18nProvider.getSampleMessages().renderingDrawRectangle());
    button5.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        map.getVectorContext().drawGroup(map.getGroup(RenderGroup.SCREEN), group2);
        ShapeStyle style = new ShapeStyle("#337788", 0.5f, "#337766", 1, 2);
        map.getVectorContext().drawRectangle(group2, "rectangle", new Bbox(50, 200, 200, 50), style);
      }
    });
    button5.setWidth100();
    column2.addMember(button5);

    // Button6: Draw Image
    IButton button6 = new IButton(I18nProvider.getSampleMessages().renderingDrawImage());
    button6.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        map.getVectorContext().drawGroup(map.getGroup(RenderGroup.SCREEN), group1);
        Image image = new Image("image");
        image.setHref(Geomajas.getIsomorphicDir() + "geomajas/example/images/smile.png");
        image.setBounds(new Bbox(250, 70, 48, 48));
        image.setStyle(new PictureStyle(0.5));
        // map.render(image, "all");
        map.getVectorContext().drawImage(group1, image.getId(), image.getHref(), image.getBounds(),
            (PictureStyle) image.getStyle());
      }
    });
    button6.setWidth100();
    column2.addMember(button6);

    // Button7: Set cursor
    IButton button7 = new IButton(I18nProvider.getSampleMessages().renderingNewCursor());
    button7.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        map.getVectorContext().setCursor(group2, "rectangle", "wait");
      }
    });
    button7.setWidth100();
    column3.addMember(button7);

    // Button8: Transform elements
    IButton button8 = new IButton(I18nProvider.getSampleMessages().renderingTransform());
    button8.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        map.getVectorContext().drawGroup(map.getGroup(RenderGroup.SCREEN), group1,
            new Matrix(0, 0, 0, 0, 150, 00));
        map.getVectorContext().drawGroup(map.getGroup(RenderGroup.SCREEN), group2,
            new Matrix(0, 0, 0, 0, 0, 100));
      }
    });
    button8.setWidth100();
    column3.addMember(button8);

    // Button9: Delete everything
    IButton button9 = new IButton(I18nProvider.getSampleMessages().renderingDelete());
    button9.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        map.getVectorContext().deleteGroup(group1);
        map.getVectorContext().deleteGroup(group2);
      }
    });
    button9.setWidth100();
    column3.addMember(button9);
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("mapVectorSecurity", "gwt-samples");
    map.setController(new PanController(map));
    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) {
          map.destroy();
          map = new MapWidget("mapVectorSecurity", "gwt-samples");
          mapLayout.addMember(map);
          map.setController(new PanController(map));
        }
      }
    };
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.