Examples of Polygon


Examples of org.geomajas.puregwt.client.spatial.Polygon

  }

  private Path toPath(MultiPolygon multiPolygon) {
    Path path = toPath((Polygon) multiPolygon.getGeometryN(0));
    for (int g = 1; g < multiPolygon.getNumGeometries(); g++) {
      Polygon polygon = (Polygon) multiPolygon.getGeometryN(g);

      LinearRing exteriorRing = polygon.getExteriorRing();
      path.moveTo((int) exteriorRing.getCoordinate().getX(), (int) exteriorRing.getCoordinate().getY());
      for (int i = 1; i < exteriorRing.getNumPoints() - 1; i++) {
        Coordinate coordinate = exteriorRing.getCoordinateN(i);
        path.lineTo((int) coordinate.getX(), (int) coordinate.getY());
      }
      path.close();

      for (int i = 0; i < polygon.getNumInteriorRing(); i++) {
        LinearRing interiorRing = polygon.getInteriorRingN(i);
        path.moveTo((int) interiorRing.getCoordinate().getX(), (int) interiorRing.getCoordinate().getY());
        for (int j = 1; j < interiorRing.getNumPoints() - 1; j++) {
          Coordinate coordinate = interiorRing.getCoordinateN(j);
          path.lineTo((int) coordinate.getX(), (int) coordinate.getY());
        }
View Full Code Here

Examples of org.gwtopenmaps.openlayers.client.geometry.Polygon

    public boolean convertPolygonToMultiPolygon() {
        final Geometry g = this.getGeometry();

        if (g.getClassName().equals(
                org.gwtopenmaps.openlayers.client.geometry.Geometry.POLYGON_CLASS_NAME)) {
            final Polygon p = Polygon.narrowToPolygon(g.getJSObject());
            final MultiPolygon mp = new MultiPolygon(new Polygon[]{p});
            this.getJSObject().setProperty("geometry", mp.getJSObject());

            return true;
        } else {
View Full Code Here

Examples of org.kalimullin.fsraytracer.geometry.Polygon

            // Face parsing
            case "point-id":
                currentFacePoints.add(pointMap.get(Integer.parseInt(currentElementValue)));
                break;
            case "face":
                polygonMap.put(currentId, new Polygon(new Face(currentFacePoints)));
                break;
            // SceneObject parsing
            case "face-id":
                polygonSet.add(polygonMap.get(Integer.parseInt(currentElementValue)));
                break;
View Full Code Here

Examples of org.newdawn.fizzy.Polygon

    if (terrain.length == 1) terrain = new CompoundShape[Constants.MAX_WIDTH];
    for (int x = 0; x < Constants.MAX_WIDTH; x++) {
      if (x < leftmostXFromExplosion && leftmostXFromExplosion != 1000000f) continue;
      if (x > rightmostXFromExplosion && rightmostXFromExplosion != -1f) continue;

      Polygon temp = new Polygon();
      CompoundShape compoundTemp = new CompoundShape();
      Vec2 firstPoint = null;
      Vec2 lastPoint = null;

      for (int y = 0; y < Constants.MAX_HEIGHT * 2; y++) {
        if (terrainBitmap[x][y] > 0.5) {
          if (firstPoint == null)
            firstPoint = new Vec2(x, y);
          else
            lastPoint = new Vec2(x, y);
        } else {
          if (firstPoint != null) {
            if (lastPoint == null)
              lastPoint = new Vec2(firstPoint.x + 0.1f,
                  firstPoint.y);
            temp.setPoints(new Vec2[] { firstPoint, lastPoint });
            compoundTemp.add(temp);
            temp = new Polygon();
            firstPoint = null;
            lastPoint = null;
          }
        }
      }
      if (firstPoint != null) {
        if (lastPoint == null)
          lastPoint = new Vec2(firstPoint.x + 0.1f, firstPoint.y);
        temp.setPoints(new Vec2[] { lastPoint, firstPoint });
        compoundTemp.add(temp);
        temp = new Polygon();
        firstPoint = null;
        lastPoint = null;
      }
      terrain[x] = compoundTemp;
      compoundTemp = new CompoundShape();
View Full Code Here

Examples of org.newdawn.slick.geom.Polygon

    Point2d vecMinViewFieldPoint = VecMathUtils.getScaledVectorPoint(vecMinViewField, lightSensorPoint, 300);
    Point2d vecMaxViewFieldPoint = VecMathUtils.getScaledVectorPoint(vecMaxViewField, lightSensorPoint, 300);
    // drawLine(lightSensorPoint, vecMinViewFieldPoint, g);
    // drawLine(lightSensorPoint, vecMaxViewFieldPoint, g);

    Polygon pol = new Polygon();
    pol.addPoint((float) lightSensorPoint.getX(), (float) lightSensorPoint.getY());
    pol.addPoint((float) vecMaxViewFieldPoint.getX(), (float) vecMaxViewFieldPoint.getY());
    pol.addPoint((float) vecMinViewFieldPoint.getX(), (float) vecMinViewFieldPoint.getY());

    // GradientFill fill = new GradientFill((float) lightSensorPoint.getX(),
    // (float) lightSensorPoint.getY(), Color.lightGray,
    // (float) viewDirectionPoint.getX(), (float) viewDirectionPoint.getY(),
    // Color.black);
View Full Code Here

Examples of org.nlogo.shape.Polygon

      // curves are not currently supported - ST 6/11/04
      //case VectorShape.CURVE:
      //    return new Curve
      //        ( start, last, editorDialog.getElementColor() ) ;
      else if (editorDialog.getElementType() == Polygon.class) {
        return new Polygon
            (start, editorDialog.getElementColor());
      }
      // ellipses are not currently supported - ST 6/11/04
      //case VectorShape.ELLIPSE:
      //    return new Ellipse
View Full Code Here

Examples of org.opengis.geometry.coordinate.Polygon

                        box.getNorthBoundLatitude(), DefaultGeographicCRS.WGS84);
            } else if (extent2 instanceof BoundingPolygon) {
                BoundingPolygon boundingpoly = (BoundingPolygon) extent2;
                Collection<? extends Geometry> polygons = boundingpoly.getPolygons();
                for (Geometry geometry : polygons) {
                    Polygon poly = (Polygon) geometry;
                    org.opengis.geometry.Envelope envelope = poly.getBoundary().getEnvelope();
                    env = new ReferencedEnvelope(envelope.getMinimum(0), envelope.getMaximum(0),
                            envelope.getMinimum(1), envelope.getMaximum(1), envelope
                                    .getLowerCorner().getCoordinateReferenceSystem());
                    break;
                }
View Full Code Here

Examples of org.poly2tri.geometry.polygon.Polygon

      Collection<LineSegmentXZ> segments,
      Collection<VectorXZ> points) throws TriangulationException {
   
    /* prepare data for triangulation */
   
    Polygon triangulationPolygon = toPolygon(outerPolygon);
   
    for (SimplePolygonXZ hole : holes) {
      triangulationPolygon.addHole(toPolygon(hole));
    }
   
    //TODO collect points and constraints from segments
   
    for (VectorXZ p : points) {
      triangulationPolygon.addSteinerPoint(toTPoint(p));
    }
   
    try {
     
      /* run triangulation */
     
      Poly2Tri.triangulate(triangulationPolygon);
     
      /* convert the result to the desired format */
     
      List<DelaunayTriangle> triangles = triangulationPolygon.getTriangles();
     
      List<TriangleXZ> result = new ArrayList<TriangleXZ>(triangles.size());
     
      for (DelaunayTriangle triangle : triangles) {
        result.add(toTriangleXZ(triangle));
View Full Code Here

Examples of org.postgis.Polygon

   * @param points
   *            The points to build a polygon from.
   * @return The Polygon object.
   */
  public Polygon createPolygon(Point[] points) {
    Polygon result;
   
    result = new Polygon(new LinearRing[] {new LinearRing(points)});
    result.srid = 4326;
   
    return result;
  }
View Full Code Here

Examples of org.primefaces.model.map.Polygon

    MapModel model = map.getModel();
   
    writer.write(",polygons:[");
   
    for(Iterator<Polygon> polygons = model.getPolygons().iterator(); polygons.hasNext();) {
      Polygon polygon = (Polygon) polygons.next();
     
      writer.write("new google.maps.Polygon({");
      writer.write("id:'" + polygon.getId() + "'");
     
      encodePaths(facesContext, polygon.getPaths());
     
      writer.write(",strokeOpacity:" + polygon.getStrokeOpacity());
      writer.write(",strokeWeight:" + polygon.getStrokeWeight());
      writer.write(",fillOpacity:" + polygon.getFillOpacity());
     
      if(polygon.getStrokeColor() != null) writer.write(",strokeColor:'" + polygon.getStrokeColor() + "'");
      if(polygon.getFillColor() != null) writer.write(",fillColor:'" + polygon.getFillColor() + "'");
     
      writer.write("})");
     
      if(polygons.hasNext())
        writer.write(",");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.