Package org.geomajas.gwt.client.gfx

Examples of org.geomajas.gwt.client.gfx.GraphicsContext


    // After map initialization we draw an image on the map:
    map.getMapModel().addMapModelHandler(new MapModelHandler() {

      public void onMapModelChange(MapModelEvent event) {
        GraphicsContext graphics = map.getVectorContext();
        graphics.drawRectangle(map.getGroup(RenderGroup.SCREEN), "rectangle", rectangle, style);
        map.getVectorContext().setController(map.getGroup(RenderGroup.SCREEN), "rectangle", customController);
      }
    });

    layout.addMember(map);
View Full Code Here


      if (geometry instanceof LineString) {
        context.getVectorContext().drawLine(group, gfxGeometry.getId(), (LineString) geometry, shapeStyle);
      } else if (geometry instanceof MultiLineString) {
        MultiLineString m = (MultiLineString) geometry;
        String gfxId = gfxGeometry.getId();
        GraphicsContext gc = context.getVectorContext();
        for (int i = 0; i < m.getNumGeometries(); i++) {
          gc.drawLine(group, gfxId + "." + i, (LineString) m.getGeometryN(i), shapeStyle);
        }
      } else if (geometry instanceof Polygon) {
        context.getVectorContext().drawPolygon(group, gfxGeometry.getId(), (Polygon) geometry, shapeStyle);
      } else if (geometry instanceof MultiPolygon) {
        MultiPolygon m = (MultiPolygon) geometry;
        String gfxId = gfxGeometry.getId();
        GraphicsContext gc = context.getVectorContext();
        for (int i = 0; i < m.getNumGeometries(); i++) {
          gc.drawPolygon(group, gfxId + "." + i, (Polygon) m.getGeometryN(i), shapeStyle);
        }
      } else if (geometry instanceof Point) {
        context.getVectorContext().drawSymbolDefinition(group, gfxGeometry.getId() + ".def",
            gfxGeometry.getSymbolInfo(), shapeStyle, null);
        context.getVectorContext().drawSymbol(group, gfxGeometry.getId(), geometry.getCoordinate(), shapeStyle,
            gfxGeometry.getId() + ".def");
      } else if (geometry instanceof MultiPoint) {
        Coordinate[] coordinates = geometry.getCoordinates();
        String gfxId = gfxGeometry.getId();
        GraphicsContext gc = context.getVectorContext();
        String styleTypeDef = gfxGeometry.getId() + ".def";
        context.getVectorContext().drawSymbolDefinition(group, styleTypeDef, gfxGeometry.getSymbolInfo(),
            shapeStyle, null);
        for (int i = 0; i < coordinates.length; i++) {
          gc.drawSymbol(group, gfxId + "." + i, coordinates[i], shapeStyle, styleTypeDef);
        }
      }
    }
  }
View Full Code Here

    Geometry geom = gfxGeometry.getGeometry();
    if (geom instanceof Point || geom instanceof MultiPoint) {
      context.getVectorContext().deleteElement(group, gfxGeometry.getId() + ".def");
    }
    if (geom instanceof MultiPolygon || geom instanceof MultiLineString || geom instanceof MultiPoint) {
      GraphicsContext gc = context.getVectorContext();
      String gfxId = gfxGeometry.getId();
      for (int i = 0; i < geom.getNumGeometries(); i++) {
        gc.deleteElement(group, gfxId + "." + i);
      }
    } else {
      context.getVectorContext().deleteElement(group, gfxGeometry.getId());
    }
  }
View Full Code Here

TOP

Related Classes of org.geomajas.gwt.client.gfx.GraphicsContext

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.