Package org.zkoss.openlayers.feature

Examples of org.zkoss.openlayers.feature.Vector


            pair("renderers",
                new Object[] { "SVG", "VML", "Canvas" })));

    // create a point feature
    Point point = new Point(-111.04, 45.68);
    Vector pointFeature = new Vector(point, null, style_blue);
    Point point2 = new Point(-105.04, 49.68);
    Vector pointFeature2 = new Vector(point2, null, style_green);
    Point point3 = new Point(-105.04, 49.68);
    Vector pointFeature3 = new Vector(point3, null, style_mark);

    // create a line feature from a list of points
    List<Point> pointList = new ArrayList<Point>();
    Point newPoint = point;
    for (int p = 0; p < 15; ++p) {
      newPoint = new Point(newPoint.getX() + Math.random(),
          newPoint.getY() + Math.random());
      pointList.add(newPoint);
    }

    Vector lineFeature = new Vector(new LineString(pointList), null,
        style_green);

    // create a polygon feature from a linear ring of points
    List<Point> point2List = new ArrayList<Point>();
    for (int p = 0; p < 6; ++p) {
      double a = p * (2 * Math.PI) / 7;
      double r = Math.random() + 1;
      Point newPoint1 = new Point(point.getX() + (r * Math.cos(a)),
          point.getY() + (r * Math.sin(a)));
      point2List.add(newPoint1);
    }
    point2List.add(point2List.get(0));

    LinearRing linearRing = new LinearRing(point2List);
    List<LinearRing> ringList = new ArrayList<LinearRing>();
    ringList.add(linearRing);
    Vector polygonFeature = new Vector(new Polygon(ringList));

    map.addLayer(vectorLayer);
    map.setCenter(new LonLat(point.getX(), point.getY()), 5);
    vectorLayer.addFeatures(Arrays.asList(pointFeature, pointFeature3,
        pointFeature2, lineFeature, polygonFeature));
View Full Code Here


                            "${yOffset}")))))),
            pair("renderers",
                new Object[] { "SVG", "VML", "Canvas" })));

    Point point = new Point(-111.04, 45.68);
    Feature pointFeature = new Vector(point, toMap(pair("name", "toto"),
        pair("age", 20), pair("favColor", "red"), pair("align", "cm")));

    // create a polygon feature from a linear ring of points
    List<Point> pointList = new ArrayList<Point>();
    for (int p = 0; p < 6; ++p) {
      double a = p * (2 * Math.PI) / 7;
      double r = Math.random() + 1;
      Point newPoint = new Point(point.getX() + 5 + (r * Math.cos(a)),
          point.getY() + 5 + (r * Math.sin(a)));
      pointList.add(newPoint);
    }

    pointList.add(pointList.get(0));

    LinearRing linearRing = new LinearRing(pointList);
    Vector polygonFeature = new Vector(new Polygon(
        Arrays.asList(linearRing)), toMap(pair("name", "dude"),
        pair("age", 21), pair("favColor", "purple"),
        pair("align", "lb")));

    Vector multiFeature = new Vector(new Collection(Arrays.asList(
        new LineString(Arrays.asList(new Point(-105, 40.0), new Point(
            -95, 45.0))), new Point(-105, 40))), toMap(
        pair("name", "ball-and-chain"), pair("age", 30),
        pair("favColor", "black"), pair("align", "rt")));

    // Create a point feature to show the label offset options
    Point labelOffsetPoint = new Point(-101.04, 35.68);
    Vector labelOffsetFeature = new Vector(labelOffsetPoint, toMap(
        pair("name", "offset"), pair("age", 22),
        pair("favColor", "blue"), pair("align", "cm"),
        // positive value moves the label to the right
        pair("xOffset", 50),
        // negative value moves the label down
        pair("xOffset", -15)));
    Vector nullFeature = new Vector(null, toMap(
        pair("name", "toto is some text about the world"),
        pair("age", 20), pair("favColor", "red"), pair("align", "cm")));
    map.addLayer(vectorLayer);
    vectorLayer.drawFeature(multiFeature);
    map.setCenter(new LonLat(-109.370078125, 43.39484375), 4);
View Full Code Here

TOP

Related Classes of org.zkoss.openlayers.feature.Vector

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.