Package org.geomajas.gwt.client.gfx.paintable

Examples of org.geomajas.gwt.client.gfx.paintable.GfxGeometry


    }
    mapRasterizingInfo.getExtraLayers().clear();
    for (WorldPaintable worldPaintable : map.getWorldPaintables().values()) {
      if (worldPaintable instanceof GfxGeometry) {
        ClientGeometryLayerInfo layer = new ClientGeometryLayerInfo();
        GfxGeometry geometry = (GfxGeometry) worldPaintable;
        layer.getGeometries().add(GeometryConverter.toDto((Geometry) geometry.getOriginalLocation()));
        FeatureStyleInfo style = new FeatureStyleInfo();
        style.setFillColor(geometry.getStyle().getFillColor());
        style.setFillOpacity(geometry.getStyle().getFillOpacity());
        style.setStrokeColor(geometry.getStyle().getStrokeColor());
        style.setStrokeOpacity(geometry.getStyle().getStrokeOpacity());
        style.setStrokeWidth((int) geometry.getStyle().getStrokeWidth());
        style.applyDefaults();
        layer.setStyle(style);
        layer.setLayerType(geometry.getGeometry().getLayerType());
        layer.setLabel(geometry.getId());
        layer.setId(geometry.getId());
        mapRasterizingInfo.getExtraLayers().add(layer);
      }
    }
  }
View Full Code Here


  }

  // Private methods:

  private void createTempPoint() {
    tempPoint = new GfxGeometry("PointDrawController.updatePoint");
    tempPoint.setStyle(drawStyle);
    tempPoint.setSymbolInfo(symbolStyle);

    Coordinate coords = getTransformer().worldToPan(geometry.getCoordinate());
    Point point = (Point) geometry.getGeometryFactory().createPoint(coords);
View Full Code Here

      Coordinate[] worldCoords = geometry.getCoordinates();
      for (int i = 0; i < srCoords.length; i++) {
        srCoords[i] = getTransformer().worldToPan(worldCoords[i]);
      }

      tempLineEnd = new GfxGeometry("LineStringEditController.updateLineEnd");
      tempLineEnd.setStyle(new ShapeStyle("#FF3322", 0.5f, "#FF3322", 1, 1));

      linearRing = geometry.getGeometryFactory().createLinearRing(srCoords);
      Polygon polygon = geometry.getGeometryFactory().createPolygon(linearRing, null);
View Full Code Here

  // Private methods:

  private void createTempLine() {
    if (tempLine1 == null && geometry instanceof Polygon) {
      tempLine1 = new GfxGeometry("LineStringEditController.updateLine1");
      tempLine2 = new GfxGeometry("LineStringEditController.updateLine2");

      if (geometry.isValid()) {
        tempLine1.setStyle(drawStyleGood);
        tempLine2.setStyle(drawStyleGood);
View Full Code Here

    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) {
View Full Code Here

    }
  }

  private void updateGeomOnMap() {
    if (worldpaintable == null) {
      worldpaintable = new GfxGeometry(GeometricSearchCreator.IDENTIFIER + "_SELECTION_GEOMETRY");
      worldpaintable.setStyle(selectionStyle);
    } else {
      mapWidget.unregisterWorldPaintable(worldpaintable);
    }
View Full Code Here

  // Private methods:

  private void createTempLine(Geometry geometry) {
    if (tempLine == null) {
      tempLine = new GfxGeometry("LineStringDrawController.updateLine");
      tempLine.setStyle(drawStyle);

      tempLineEnd = new GfxGeometry("LineStringDrawController.updateLine");
      tempLineEnd.setStyle(drawStyle);
    }

    Coordinate[] srCoords = new Coordinate[geometry.getCoordinates().length];
    Coordinate[] worldCoords = geometry.getCoordinates();
View Full Code Here

   * @param context
   *            A MapContext object, responsible for actual drawing.
   */
  public void paint(Paintable paintable, Object group, MapContext context) {
    if (paintable != null) {
      GfxGeometry gfxGeometry = (GfxGeometry) paintable;
      Geometry geometry = gfxGeometry.getGeometry();
      ShapeStyle shapeStyle = gfxGeometry.getStyle();
      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

   *            The group where the object resides in (optional).
   * @param context
   *            The context to paint on.
   */
  public void deleteShape(Paintable paintable, Object group, MapContext context) {
    GfxGeometry gfxGeometry = (GfxGeometry) paintable;
    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

    if (featureTransaction.getNewFeatures() != null && featureTransaction.getNewFeatures().length > 0
        && tempLine == null) {
      Coordinate position = getPanPosition(event);
      LineString lineString = getGeometryIndex().getGeometry(featureTransaction).getGeometryFactory()
          .createLineString(new Coordinate[] { position, position });
      tempLine = new GfxGeometry("LineStringEditController.updateLine");
      tempLine.setGeometry(lineString);
      tempLine.setStyle(new ShapeStyle("#FFFFFF", 0, "#FF3322", 1, 1));
      mapWidget.render(tempLine, RenderGroup.VECTOR, RenderStatus.ALL);
    }
  }
View Full Code Here

TOP

Related Classes of org.geomajas.gwt.client.gfx.paintable.GfxGeometry

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.