Package com.google.gwt.maps.client.geom

Examples of com.google.gwt.maps.client.geom.Point


      // Only set the rectangle's size if the map's size has changed
      if (!force) {
        return;
      }

      Point sw = map.convertLatLngToDivPixel(bounds.getSouthWest());
      Point ne = map.convertLatLngToDivPixel(bounds.getNorthEast());
      pane.setWidgetPosition(rectangle, Math.min(sw.getX(), ne.getX()),
          Math.min(sw.getY(), ne.getY()));

      int width = Math.abs(ne.getX() - sw.getX()) - weight;
      int height = Math.abs(ne.getY() - sw.getY()) - weight;
      rectangle.setSize(width + "px", height + "px");
    }
View Full Code Here


        m.setSize("500px", "500px");
        RootLayoutPanel.get().add(m);

        new Timer() {
          public void run() {
            Point result;
            assertTrue(m.isVisible());
            assertTrue(m.isAttached());

            result = m.convertLatLngToContainerPixel(LatLng.newInstance(45, 45));
            assertNotNull("convertLatLngToContainerPixel()", result);
            result = m.convertLatLngToDivPixel(LatLng.newInstance(45, 45));
            assertNotNull("convertLatLngToDivPixel()", result);

            result = m.convertLatLngToContainerPixel(LatLng.newInstance(0, 0));
            assertNotNull("convertLatLngToContainerPixel()", result);
            assertEquals("convertLatLngToContainerPixel().getX() == 250", 250,
                result.getX());
            assertEquals("convertLatLngToContainerPixel().getY() == 250", 250,
                result.getY());

            result = m.convertLatLngToDivPixel(LatLng.newInstance(0, 0));
            assertNotNull("convertLatLngToDivPixel()", result);
            assertEquals("convertLatLngToDivPixel().getX() == 250", 250,
                result.getX());
            assertEquals("convertLatLngToDivPixel().getY() == 250", 250,
                result.getY());

            LatLng latLng;
            latLng = m.convertContainerPixelToLatLng(Point.newInstance(100, 100));
            assertNotNull("convertContainerPixelToLatLng()", result);
            latLng = m.convertDivPixelToLatLng(Point.newInstance(100, 100));
View Full Code Here

        m.addMapRightClickHandler(new MapRightClickHandler() {

          @SuppressWarnings("deprecation")
          public void onRightClick(MapRightClickEvent event) {
            assertEquals(event.getSender(), m);
            Point p = event.getPoint();
            Marker marker = (Marker) event.getOverlay();
            Element elem = event.getElement();
            assertNotNull("point is null", p);
            assertTrue(p.getX() == 101);
            assertTrue(p.getY() == 222);
            assertNotNull("element is null", elem);
            assertNotNull("maker is null", marker);
            assertTrue(marker.getPoint().getLatitude() == 12.34);
            assertTrue(marker.getPoint().getLongitude() == -22.2);
            finishTest();
View Full Code Here

  public void testIconAccessors() {
    loadApi(new Runnable() {
      public void run() {
        Icon ic = Icon.newInstance();

        Point pointA = Point.newInstance(10, 20);
        ic.setDragCrossAnchor(pointA);
        assertEquals("DragCrossAnchor", pointA, ic.getDragCrossAnchor());

        String dragCrossImage = "DragCrossImage";
        ic.setDragCrossImageURL(dragCrossImage);
        assertEquals("DragCrossImageURL", dragCrossImage,
            ic.getDragCrossImageUrl());

        Size size1 = Size.newInstance(20, 20);
        ic.setDragCrossSize(size1);
        assertEquals("DragCrossSize", size1, ic.getDragCrossSize());

        Point pointB = Point.newInstance(20, 30);
        ic.setIconAnchor(pointB);
        assertEquals("IconAnchor", pointB, ic.getIconAnchor());

        Size size2 = Size.newInstance(2, 2);
        ic.setIconSize(size2);
        assertEquals("IconSize", size2, ic.getIconSize());

        int[] map1 = {1, 2, 3, 4};
        ic.setImageMap(map1);
        assertEquals("ImageMap length", map1.length, ic.getImageMap().length());
        for (int i = 0; i < map1.length; i++) {
          assertEquals("ImageMap", map1[i], ic.getImageMapArray()[i]);
        }

        JsArrayInteger map2 = JavaScriptObject.createArray().cast();
        map2.set(0, 4);
        map2.set(1, 5);
        map2.set(2, 6);
        map2.set(3, 7);
        ic.setImageMap(map2);
        for (int i = 0; i < map2.length(); i++) {
          assertEquals("ImageMap", map2.get(i), ic.getImageMap().get(i));
        }

        String dummyImage = "DummyImage";
        ic.setImageURL(dummyImage);
        assertEquals("ImageURL", dummyImage, ic.getImageURL());

        Point pointC = Point.newInstance(100, 20);
        ic.setInfoWindowAnchor(pointC);
        assertEquals("InfoWindowAnchor", pointC, ic.getInfoWindowAnchor());

        ic.setMaxHeight(10);
        assertEquals("MaxHeight", 10, ic.getMaxHeight());
View Full Code Here

            RegionPolygon polygon = (RegionPolygon) event.getOverlay();
            // TODO: only add the control if the polygon information is already loaded in the edit panel
            if( polyIsLoadedFromPanel )
            {
              GWT.log("Clicked on RegionPolygon:" + polygon.getRegionDetailsId());
              Point clickedPoint = event.getPoint();
              GWT.log("Clicked point:" + clickedPoint.toString());
              map.addControl(new RegionContextMenuControl(eb, clickedPoint));
            }
           
          }
        }
View Full Code Here

   */
  @Override
  protected int getCurrentVertex() {
    int temp = -1;
    for (int i = 0; i < polyline.getVertexCount(); i++) {
      Point vp = mapMenuController.getMapWidget()
          .convertLatLngToContainerPixel(polyline.getVertex(i));
      if ((Math.abs(vp.getX()
          - mapMenuController.getCurrentMouseDivPosition().getX()) < 7)
          && (Math.abs(vp.getY()
              - mapMenuController.getCurrentMouseDivPosition()
                  .getY()) < 7)) {
        temp = i;
        break;
      }
View Full Code Here

   */
  @Override
  protected int getCurrentVertex() {
    int temp = -1;
    for (int i = 0; i < polygon.getVertexCount(); i++) {
      Point vp = mapMenuController.getMapWidget()
          .convertLatLngToContainerPixel(polygon.getVertex(i));
      if ((Math.abs(vp.getX()
          - mapMenuController.getCurrentMouseDivPosition().getX()) < 7)
          && (Math.abs(vp.getY()
              - mapMenuController.getCurrentMouseDivPosition()
                  .getY()) < 7)) {
        temp = i;
        break;
      }
View Full Code Here

         * We check if the location has changed, because Google Maps allows
         * infinite panning along the east-west-axis (see issue 38) and requires
         * an updated widget location in this case, although it will not force
         * redrawing.
         */
        Point newLocationPoint = map.convertLatLngToDivPixel(location);

        if (!force && sameLocation(newLocationPoint)) {
            return;
        }

View Full Code Here

    /* Add our textPanel to the main map pane */
    final MapPane pane = map.getPane(MapPaneType.MARKER_PANE);
    pane.add(textPanel);

    /* Place the textPanel on the pane in the correct spot */
    final Point locationPoint = map.convertLatLngToDivPixel(getLatLng());
    final Point offsetPoint = Point.newInstance(
        locationPoint.getX() - getOffset().getX(),
        locationPoint.getY() - getOffset().getY());
    pane.setWidgetPosition(textPanel, offsetPoint.getX(), offsetPoint.getY());
  }
View Full Code Here

  }

  @Override
  protected void redraw(boolean force) {

    Point point = _map.convertLatLngToDivPixel(_northWestCorner);
    int x = point.getX();
    int y = point.getY();

    _map.getPane(MapPaneType.MARKER_SHADOW_PANE).setWidgetPosition(_widget, x,
        y);

    Point point2 = _map.convertLatLngToDivPixel(_southEastCorner);
    int x2 = point2.getX();
    int y2 = point2.getY();

    _widget.setWidth((x2 - x) + "px");
    _widget.setHeight((y2 - y) + "px");
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.maps.client.geom.Point

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.