Examples of ShapeFeature


Examples of chunmap.data.feature.ShapeFeature

  @Override
  public void execute(Feature obj) {
    if (trans == null) return;
    if (obj instanceof ShapeFeature) {
      ShapeFeature shape = (ShapeFeature) obj;
      Geometry g = (shape.getGeometry());
      if (g == null)
        return;
      Geometry ng = g.transform(trans);
      shape.setGeometry(ng);
    }
  }
View Full Code Here

Examples of chunmap.data.feature.ShapeFeature

        FeatureCollection fc = pDA.createFeatureList();
        fc.each(new VisitAction(){
      @Override
      public void execute(Feature obj) {
        ShapeFeature shp = (ShapeFeature)obj;
        Object[] data=pDR.data(shp.getId());
        shp.setValues(data);
              String s = data[labelColum].toString();
              shp.setLabel(s);
      }});
        fc.setFeatureSchama(pDR.getFeatureSchama());
        pDR.close();
        return new VectorLayer(fc);
    }
View Full Code Here

Examples of chunmap.data.feature.ShapeFeature

        if (gs.size() == 0) return null;

        FeatureCollection fc = new FeatureList();
        EnvelopeBuf eb = new EnvelopeBuf();
        for(Geometry g : gs){
          ShapeFeature f = createFeature(g);
            fc.insert(f);
            f.setFeatureClass(fc);
            eb.mergeEnvelop(g.getEnvelop());
        }

        fc.setMetadata( new LayerMetadata("Geometry",gs.get(0).getGeometryType()));
        fc.setEnvelope(eb.toEnvelop());
View Full Code Here

Examples of chunmap.data.feature.ShapeFeature

        return new VectorLayer(fc);
    }
    private static ShapeFeature createFeature(Geometry g)
    {
      ShapeFeature shp = new ShapeFeature();
        shp.setGeometry(g);
        return shp;
    }
View Full Code Here

Examples of chunmap.data.feature.ShapeFeature

                Geometry geo=dataResources.getGeometry(i);
                if (geo == null)
                {
                    continue;
                }
                ShapeFeature shape = new ShapeFeature();
                shape.setGeometry(geo);
                shape.setId(i);

                featureClass.insert(shape);
                shape.setFeatureClass(featureClass);
            }
        }
        featureClass.setDataResources(dataResources);
        featureClass.setEnvelope(dataResources.getEnvelop());
        featureClass.setMetadata(dataResources.getMetadata());
View Full Code Here

Examples of chunmap.data.feature.ShapeFeature

            map.getLayerCollection().add(layer);
            map.fullView();
        }
        else
        {
          ShapeFeature f = createFeature(g);
            layer.getFeatures().insert(f);
            f.setFeatureClass(layer.getFeatures());

            EnvelopeBuf eb = new EnvelopeBuf(layer.getEnvelop());
            eb.mergeEnvelop(g.getEnvelop());
            ((FeatureSet)layer.getFeatures()).setEnvelope(eb.toEnvelop());
            map.getLayerCollection().reComputeEnvelop();
View Full Code Here

Examples of chunmap.data.feature.ShapeFeature

            map.getLayerCollection().reComputeEnvelop();
        }
    }
    private ShapeFeature createFeature(Geometry g)
    {
      ShapeFeature shp = new ShapeFeature();
        shp.setGeometry ( g);
        return shp;
    }
View Full Code Here

Examples of de.fhpotsdam.unfolding.data.ShapeFeature

    if (feature.getType() == Feature.FeatureType.POINT) {
      PointFeature pf = (PointFeature) feature;
      locations.add(pf.getLocation());
    }
    if (feature.getType() == Feature.FeatureType.LINES || feature.getType() == Feature.FeatureType.POLYGON) {
      ShapeFeature sf = (ShapeFeature) feature;
      locations.addAll(sf.getLocations());
    }
    if (feature.getType() == Feature.FeatureType.MULTI) {
      MultiFeature multiFeature = (MultiFeature) feature;
      for (Feature f : multiFeature.getFeatures()) {
        locations.addAll(getLocations(f));
View Full Code Here

Examples of de.fhpotsdam.unfolding.data.ShapeFeature

    List<Feature> transitLines = GeoJSONReader.loadData(this, "data/MBTARapidTransitLines.json");

    // Create marker from features, and use LINE property to color the markers.
    List<Marker> transitMarkers = new ArrayList<Marker>();
    for (Feature feature : transitLines) {
      ShapeFeature lineFeature = (ShapeFeature) feature;

      SimpleLinesMarker m = new SimpleLinesMarker(lineFeature.getLocations());
      String lineColor = lineFeature.getStringProperty("LINE");
      int color = 0;
      // Original MBTA colors
      if (lineColor.equals("BLUE")) {
        color = color(44, 91, 167);
      }
View Full Code Here

Examples of de.fhpotsdam.unfolding.data.ShapeFeature

    Calendar prevTime = null;
    Location prevLocation = null;

    // Create track with all track points
    ShapeFeature trackFeature = new ShapeFeature(FeatureType.LINES);
    List<Double> speedList = new ArrayList<Double>();

    XML[] itemXML = gpx.getChildren("trk/trkseg/trkpt");
    for (int i = 0; i < itemXML.length; i++) {

      // Adds location for track point
      float lat = itemXML[i].getFloat("lat");
      float lon = itemXML[i].getFloat("lon");
      Location location = new Location(lat, lon);

      // Calculates speed for track point
      // Uses time span (h) and distance (km) to previous point to get km/h
      double speed = 0;
      try {
        String timeStr = itemXML[i].getChild("time").getContent();
        // Replace "Z" for Zulu/GMT time with parseable hour offset
        timeStr = timeStr.replaceAll("Z", "+0000");
        Calendar time = StringUtils.parseIsoDateTime(timeStr);

        if (prevTime != null) {
          long timeMS = time.getTimeInMillis();
          long timeDiff = timeMS - prevTime.getTimeInMillis();
          double dist = GeoUtils.getDistance(location, prevLocation);
          speed = dist / ((float) timeDiff / 1000 / 60 / 60);
        }

        prevTime = time;
        prevLocation = location;

      } catch (ParseException e) {
        // println("Error:" + e);
      }

      speedList.add(speed);
      trackFeature.addLocation(location);
    }
    trackFeature.putProperty("speedList", speedList);
    trackFeatures.add(trackFeature);

    return trackFeatures;
  }
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.